about summary refs log tree commit diff
path: root/compiler/rustc_parse_format/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-01-15 09:27:21 +0000
committerbors <bors@rust-lang.org>2021-01-15 09:27:21 +0000
commit4e208f6a3afb42528878b0f3464e337c4bf3bbc8 (patch)
tree21529ff86f6f364980511a8cb4cb7a0001ae29c0 /compiler/rustc_parse_format/src
parentdcf622eb70aebe16d40c5f88fa2a41fa7019541c (diff)
parent7286be15fa3f18ea4bd5b6ce481426f7d78e4a57 (diff)
downloadrust-4e208f6a3afb42528878b0f3464e337c4bf3bbc8.tar.gz
rust-4e208f6a3afb42528878b0f3464e337c4bf3bbc8.zip
Auto merge of #81035 - JohnTitor:rollup-9m03awf, r=JohnTitor
Rollup of 5 pull requests

Successful merges:

 - #80254 (Don't try to add nested predicate to Rustdoc auto-trait `ParamEnv`)
 - #80834 (Remove unreachable panics from VecDeque::{front/back}[_mut])
 - #80944 (Use Option::map_or instead of `.map(..).unwrap_or(..)`)
 - #81008 (Don't ICE when computing a layout of a generator tainted by errors)
 - #81023 (Remove doctree::Variant)

Failed merges:

 - #81033 (Remove useless `clean::Variant` struct)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_parse_format/src')
-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)