about summary refs log tree commit diff
path: root/compiler/rustc_ast
diff options
context:
space:
mode:
authorMarijn Schouten <mhkbst@gmail.com>2025-01-22 16:50:22 +0100
committerMarijn Schouten <mhkbst@gmail.com>2025-01-23 11:45:42 +0100
commit5f01e12ea8035fdfc23eefaf6b580dbb9a8863ec (patch)
treeca63b69bce7df9b09d83b78d939b94d298f66f2a /compiler/rustc_ast
parentccb967438de778b7f4ee3cf94f3e8163f6f5c53f (diff)
downloadrust-5f01e12ea8035fdfc23eefaf6b580dbb9a8863ec.tar.gz
rust-5f01e12ea8035fdfc23eefaf6b580dbb9a8863ec.zip
simplify similar_tokens from Vec<_> to &[_]
Diffstat (limited to 'compiler/rustc_ast')
-rw-r--r--compiler/rustc_ast/src/token.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_ast/src/token.rs b/compiler/rustc_ast/src/token.rs
index 5b6e65c804f..100f664a89f 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) -> Vec<TokenKind> {
+    pub fn similar_tokens(&self) -> &[TokenKind] {
         match self {
-            Comma => vec![Dot, Lt, Semi],
-            Semi => vec![Colon, Comma],
-            Colon => vec![Semi],
-            FatArrow => vec![Eq, RArrow, Ge, Gt],
-            _ => vec![],
+            Comma => &[Dot, Lt, Semi],
+            Semi => &[Colon, Comma],
+            Colon => &[Semi],
+            FatArrow => &[Eq, RArrow, Ge, Gt],
+            _ => &[],
         }
     }