summaryrefslogtreecommitdiff
path: root/compiler/rustc_parse_format
diff options
context:
space:
mode:
authorLingMan <LingMan@users.noreply.github.com>2021-01-11 20:45:33 +0100
committerLingMan <LingMan@users.noreply.github.com>2021-01-14 19:23:59 +0100
commita56bffb4f9d6f7791b2fa40412bd3e0549d76cc3 (patch)
tree23875d16475aea0b37a608f0ca704a3016c1f0e4 /compiler/rustc_parse_format
parentd03fe84169d50a4b96cdef7b2f862217ab634055 (diff)
downloadrust-a56bffb4f9d6f7791b2fa40412bd3e0549d76cc3.tar.gz
Use Option::map_or instead of `.map(..).unwrap_or(..)`
Diffstat (limited to 'compiler/rustc_parse_format')
-rw-r--r--compiler/rustc_parse_format/src/lib.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_parse_format/src/lib.rs b/compiler/rustc_parse_format/src/lib.rs
index 25e3e67e28e..f7b16bd991b 100644
--- a/compiler/rustc_parse_format/src/lib.rs
+++ b/compiler/rustc_parse_format/src/lib.rs
@@ -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)