about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/diagnostics.rs
diff options
context:
space:
mode:
authorklensy <klensy@users.noreply.github.com>2021-02-24 01:02:05 +0300
committerklensy <klensy@users.noreply.github.com>2021-02-24 02:43:35 +0300
commitc75c4a579bdea69fc9b93697aa2531daf82540fc (patch)
tree625a3f482229b40902893946eb17acebb6051371 /compiler/rustc_parse/src/parser/diagnostics.rs
parent5ff1be197eaa8a014718b26b1fcbe0ced33b6e1a (diff)
downloadrust-c75c4a579bdea69fc9b93697aa2531daf82540fc.tar.gz
rust-c75c4a579bdea69fc9b93697aa2531daf82540fc.zip
replaced some map_or with map_or_else
Diffstat (limited to 'compiler/rustc_parse/src/parser/diagnostics.rs')
-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..b5b5278b5ce 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 ");