about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-02-26 15:52:31 +0100
committerGitHub <noreply@github.com>2021-02-26 15:52:31 +0100
commit039b1b62acc736080d3ecf86c249f00356ac91a0 (patch)
tree06a59887bed652640e0c2294ab8f0287038203c5 /compiler/rustc_parse/src/parser
parenta56bbb134fe98931de92b587c3b98920f6923bc9 (diff)
parent08b1e8004b06112fb8334155b2cea314bd3e8161 (diff)
downloadrust-039b1b62acc736080d3ecf86c249f00356ac91a0.tar.gz
rust-039b1b62acc736080d3ecf86c249f00356ac91a0.zip
Rollup merge of #82456 - klensy:or-else, r=estebank
Replaced some unwrap_or and map_or with lazy variants

Replaced some `unwrap_or` and `map_or` with `unwrap_or_else` and `map_or_else`.
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index 0f49386dec0..5b4939b7407 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -223,7 +223,7 @@ impl<'a> Parser<'a> {
         fn tokens_to_string(tokens: &[TokenType]) -> String {
             let mut i = tokens.iter();
             // This might be a sign we need a connect method on `Iterator`.
-            let b = i.next().map_or(String::new(), |t| t.to_string());
+            let b = i.next().map_or_else(String::new, |t| t.to_string());
             i.enumerate().fold(b, |mut b, (i, a)| {
                 if tokens.len() > 2 && i == tokens.len() - 2 {
                     b.push_str(", or ");