Use Option::map_or instead of .map(..).unwrap_or(..)
This commit is contained in:
parent
d03fe84169
commit
a56bffb4f9
50 changed files with 67 additions and 79 deletions
|
@ -347,7 +347,7 @@ impl<'a> Parser<'a> {
|
|||
let mut pos = pos;
|
||||
// This handles the raw string case, the raw argument is the number of #
|
||||
// in r###"..."### (we need to add one because of the `r`).
|
||||
let raw = self.style.map(|raw| raw + 1).unwrap_or(0);
|
||||
let raw = self.style.map_or(0, |raw| raw + 1);
|
||||
for skip in &self.skips {
|
||||
if pos > *skip {
|
||||
pos += 1;
|
||||
|
@ -814,7 +814,7 @@ fn find_skips_from_snippet(
|
|||
skips
|
||||
}
|
||||
|
||||
let r_start = str_style.map(|r| r + 1).unwrap_or(0);
|
||||
let r_start = str_style.map_or(0, |r| r + 1);
|
||||
let r_end = str_style.unwrap_or(0);
|
||||
let s = &snippet[r_start + 1..snippet.len() - r_end - 1];
|
||||
(find_skips(s, str_style.is_some()), true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue