diff options
| author | Marijn Schouten <mhkbst@gmail.com> | 2025-01-22 16:01:10 +0100 |
|---|---|---|
| committer | Marijn Schouten <mhkbst@gmail.com> | 2025-01-23 11:45:42 +0100 |
| commit | ccb967438de778b7f4ee3cf94f3e8163f6f5c53f (patch) | |
| tree | b2956af5ce03d004b1c5e61b150c2ee8f6dfe1ce /compiler/rustc_parse/src | |
| parent | cf577f34c47937ccb9983186eca5f8719da585f4 (diff) | |
| download | rust-ccb967438de778b7f4ee3cf94f3e8163f6f5c53f.tar.gz rust-ccb967438de778b7f4ee3cf94f3e8163f6f5c53f.zip | |
simplify similar_tokens from Option<Vec<_>> to Vec<_>
Diffstat (limited to 'compiler/rustc_parse/src')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_parse/src/parser/mod.rs | 6 |
2 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 5cd02128287..cf87c8c9495 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -3115,8 +3115,7 @@ impl<'a> Parser<'a> { let arm_body; let is_fat_arrow = this.check(exp!(FatArrow)); let is_almost_fat_arrow = TokenKind::FatArrow - .similar_tokens() - .is_some_and(|similar_tokens| similar_tokens.contains(&this.token.kind)); + .similar_tokens().contains(&this.token.kind); // this avoids the compiler saying that a `,` or `}` was expected even though // the pattern isn't a never pattern (and thus an arm body is required) diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 10756be6afb..aba84d44a44 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -923,10 +923,8 @@ impl<'a> Parser<'a> { _ => { // Attempt to keep parsing if it was a similar separator. - if let Some(tokens) = exp.tok.similar_tokens() { - if tokens.contains(&self.token.kind) { - self.bump(); - } + if exp.tok.similar_tokens().contains(&self.token.kind) { + self.bump(); } } } |
