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_builtin_macros/src/format.rs | |
| parent | cf577f34c47937ccb9983186eca5f8719da585f4 (diff) | |
| download | rust-ccb967438de778b7f4ee3cf94f3e8163f6f5c53f.tar.gz rust-ccb967438de778b7f4ee3cf94f3e8163f6f5c53f.zip | |
simplify similar_tokens from Option<Vec<_>> to Vec<_>
Diffstat (limited to 'compiler/rustc_builtin_macros/src/format.rs')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/format.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/compiler/rustc_builtin_macros/src/format.rs b/compiler/rustc_builtin_macros/src/format.rs index 5202fe26c40..d9cfbaf63e6 100644 --- a/compiler/rustc_builtin_macros/src/format.rs +++ b/compiler/rustc_builtin_macros/src/format.rs @@ -101,15 +101,14 @@ fn parse_args<'a>(ecx: &ExtCtxt<'a>, sp: Span, tts: TokenStream) -> PResult<'a, match p.expect(exp!(Comma)) { Err(err) => { - match token::TokenKind::Comma.similar_tokens() { - Some(tks) if tks.contains(&p.token.kind) => { - // If a similar token is found, then it may be a typo. We - // consider it as a comma, and continue parsing. - err.emit(); - p.bump(); - } + if token::TokenKind::Comma.similar_tokens().contains(&p.token.kind) { + // If a similar token is found, then it may be a typo. We + // consider it as a comma, and continue parsing. + err.emit(); + p.bump(); + } else { // Otherwise stop the parsing and return the error. - _ => return Err(err), + return Err(err); } } Ok(Recovered::Yes(_)) => (), |
