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_ast/src/token.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_ast/src/token.rs')
| -rw-r--r-- | compiler/rustc_ast/src/token.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/compiler/rustc_ast/src/token.rs b/compiler/rustc_ast/src/token.rs index 3b7367d1ee2..5b6e65c804f 100644 --- a/compiler/rustc_ast/src/token.rs +++ b/compiler/rustc_ast/src/token.rs @@ -527,13 +527,13 @@ impl TokenKind { /// Returns tokens that are likely to be typed accidentally instead of the current token. /// Enables better error recovery when the wrong token is found. - pub fn similar_tokens(&self) -> Option<Vec<TokenKind>> { - match *self { - Comma => Some(vec![Dot, Lt, Semi]), - Semi => Some(vec![Colon, Comma]), - Colon => Some(vec![Semi]), - FatArrow => Some(vec![Eq, RArrow, Ge, Gt]), - _ => None, + pub fn similar_tokens(&self) -> Vec<TokenKind> { + match self { + Comma => vec![Dot, Lt, Semi], + Semi => vec![Colon, Comma], + Colon => vec![Semi], + FatArrow => vec![Eq, RArrow, Ge, Gt], + _ => vec![], } } |
