summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authoryukang <moorekang@gmail.com>2023-05-13 18:06:58 +0800
committeryukang <moorekang@gmail.com>2023-05-13 19:40:17 +0800
commit83789b8b068ad38c6a3c937d0a2c6ca64e588c85 (patch)
tree6004b2e73324c5415bff6a8bfea50a116aed3fa0 /compiler
parentce6cfc37d033eb1fb1f2e3af1c17c218917b54ec (diff)
downloadrust-83789b8b068ad38c6a3c937d0a2c6ca64e588c85.tar.gz
fmt
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 808bbbdada6..ee712a8e1b5 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -1181,12 +1181,9 @@ impl<'a> Parser<'a> {
let close_paren = self.prev_token.span;
let span = lo.to(close_paren);
// filter shorthand fields
- let fields: Vec<_> = fields
- .into_iter()
- .filter_map(
- |field| if !field.is_shorthand { Some(field) } else { None },
- )
- .collect();
+ let fields: Vec<_> =
+ fields.into_iter().filter(|field| !field.is_shorthand).collect();
+
if !fields.is_empty() &&
// `token.kind` should not be compared here.
// This is because the `snapshot.token.kind` is treated as the same as