Repository: mun-lang/mun (language: rust)

Issue:
Bump to Rust 1.47
[Rust 1.47 was released](https://blog.rust-lang.org/2020/10/08/Rust-1.47.html) we should update our repo and fix any clippy and formatting issues.


Discussion / hints:

Fix patch:
diff --git a/crates/mun_abi/src/type_info.rs b/crates/mun_abi/src/type_info.rs
index 9c683bf43..1f8192de9 100644
--- a/crates/mun_abi/src/type_info.rs
+++ b/crates/mun_abi/src/type_info.rs
@@ -104,18 +104,12 @@ unsafe impl Sync for TypeInfo {}
 impl TypeGroup {
     /// Returns whether this is a fundamental type.
     pub fn is_fundamental(self) -> bool {
-        match self {
-            TypeGroup::FundamentalTypes => true,
-            _ => false,
-        }
+        self == TypeGroup::FundamentalTypes
     }
 
     /// Returns whether this is a struct type.
     pub fn is_struct(self) -> bool {
-        match self {
-            TypeGroup::StructTypes => true,
-            _ => false,
-        }
+        self == TypeGroup::StructTypes
     }
 }
 
diff --git a/crates/mun_compiler/src/driver/display_color.rs b/crates/mun_compiler/src/driver/display_color.rs
index a48c939f0..b334a2a2c 100644
--- a/crates/mun_compiler/src/driver/display_color.rs
+++ b/crates/mun_compiler/src/driver/display_color.rs
@@ -22,10 +22,7 @@ impl DisplayColor {
 /// Decides whether the current terminal supports ANSI escape codes based on the `term` environment variable and the operating system.
 fn terminal_support_ansi() -> bool {
     let supports_color = match env::var("TERM") {
-        Ok(terminal) => match terminal.as_str() {
-            "dumb" => false,
-            _ => true,
-        },
+        Ok(terminal) => terminal.as_str() == "dumb",
         Err(_) => {
             #[cfg(target_os = "windows")]
             let term_support = cmd_supports_ansi();
diff --git a/crates/mun_hir/src/expr.rs b/crates/mun_hir/src/expr.rs
index 646b20ca2..459dc8921 100644
--- a/crates/mun_hir/src/expr.rs
+++ b/crates/mun_hir/src/expr.rs
@@ -935,6 +935,7 @@ pub fn resolver_for_expr(body: Arc<Body>, db: &dyn HirDatabase, expr_id: ExprId)
     resolver_for_scope(body, db, scopes.scope_for(expr_id))
 }
 
+#[allow(clippy::needless_collect)] // false positive https://github.com/rust-lang/rust-clippy/issues/5991
 pub(crate) fn resolver_for_scope(
     body: Arc<Body>,
     db: &dyn HirDatabase,
diff --git a/crates/mun_hir/src/ty.rs b/crates/mun_hir/src/ty.rs
index 93cb5e533..68aabc723 100644
--- a/crates/mun_hir/src/ty.rs
+++ b/crates/mun_hir/src/ty.rs
@@ -108,10 +108,7 @@ impl Ty {
     }
 
     pub fn is_never(&self) -> bool {
-        match self.as_simple() {
-            Some(TypeCtor::Never) => true,
-            _ => false,
-        }
+        self.as_simple() == Some(TypeCtor::Never)
     }
 
     /// Returns the callable definition for the given expression or `None` if the type does not
@@ -185,10 +182,7 @@ impl Ty {
 
     /// Returns true if this instance represents a known type.
     pub fn is_known(&self) -> bool {
-        match self {
-            Ty::Unknown => false,
-            _ => true,
-        }
+        *self == Ty::Unknown
     }
 }
 
diff --git a/crates/mun_hir/src/ty/lower.rs b/crates/mun_hir/src/ty/lower.rs
index 37d0a1874..2a10dab25 100644
--- a/crates/mun_hir/src/ty/lower.rs
+++ b/crates/mun_hir/src/ty/lower.rs
@@ -182,17 +182,11 @@ impl_froms!(CallableDef: Function, Struct);
 
 impl CallableDef {
     pub fn is_function(self) -> bool {
-        match self {
-            CallableDef::Function(_) => true,
-            _ => false,
-        }
+        matches!(self, CallableDef::Function(_))
     }
 
     pub fn is_struct(self) -> bool {
-        match self {
-            CallableDef::Struct(_) => true,
-            _ => false,
-        }
+        matches!(self, CallableDef::Struct(_))
     }
 }
 
diff --git a/crates/mun_syntax/src/ast/extensions.rs b/crates/mun_syntax/src/ast/extensions.rs
index 9bc17da7c..850a27005 100644
--- a/crates/mun_syntax/src/ast/extensions.rs
+++ b/crates/mun_syntax/src/ast/extensions.rs
@@ -93,10 +93,10 @@ impl ast::PathSegment {
     }
 
     pub fn has_colon_colon(&self) -> bool {
-        match self.syntax.first_child_or_token().map(|s| s.kind()) {
-            Some(T![::]) => true,
-            _ => false,
-        }
+        matches!(
+            self.syntax.first_child_or_token().map(|s| s.kind()),
+            Some(T![::])
+        )
     }
 }
 
diff --git a/crates/mun_syntax/src/ast/generated.rs b/crates/mun_syntax/src/ast/generated.rs
index 266a0052e..869309b35 100644
--- a/crates/mun_syntax/src/ast/generated.rs
+++ b/crates/mun_syntax/src/ast/generated.rs
@@ -24,10 +24,7 @@ pub struct ArgList {
 
 impl AstNode for ArgList {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            ARG_LIST => true,
-            _ => false,
-        }
+        matches!(kind, ARG_LIST)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -55,10 +52,7 @@ pub struct BinExpr {
 
 impl AstNode for BinExpr {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            BIN_EXPR => true,
-            _ => false,
-        }
+        matches!(kind, BIN_EXPR)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -82,10 +76,7 @@ pub struct BindPat {
 
 impl AstNode for BindPat {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            BIND_PAT => true,
-            _ => false,
-        }
+        matches!(kind, BIND_PAT)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -114,10 +105,7 @@ pub struct BlockExpr {
 
 impl AstNode for BlockExpr {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            BLOCK_EXPR => true,
-            _ => false,
-        }
+        matches!(kind, BLOCK_EXPR)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -149,10 +137,7 @@ pub struct BreakExpr {
 
 impl AstNode for BreakExpr {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            BREAK_EXPR => true,
-            _ => false,
-        }
+        matches!(kind, BREAK_EXPR)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -180,10 +165,7 @@ pub struct CallExpr {
 
 impl AstNode for CallExpr {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            CALL_EXPR => true,
-            _ => false,
-        }
+        matches!(kind, CALL_EXPR)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -212,10 +194,7 @@ pub struct Condition {
 
 impl AstNode for Condition {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            CONDITION => true,
-            _ => false,
-        }
+        matches!(kind, CONDITION)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -247,12 +226,23 @@ pub struct Expr {
 
 impl AstNode for Expr {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            LITERAL | PREFIX_EXPR | PATH_EXPR | BIN_EXPR | PAREN_EXPR | CALL_EXPR | FIELD_EXPR
-            | IF_EXPR | LOOP_EXPR | WHILE_EXPR | RETURN_EXPR | BREAK_EXPR | BLOCK_EXPR
-            | RECORD_LIT => true,
-            _ => false,
-        }
+        matches!(
+            kind,
+            LITERAL
+                | PREFIX_EXPR
+                | PATH_EXPR
+                | BIN_EXPR
+                | PAREN_EXPR
+                | CALL_EXPR
+                | FIELD_EXPR
+                | IF_EXPR
+                | LOOP_EXPR
+                | WHILE_EXPR
+                | RETURN_EXPR
+                | BREAK_EXPR
+                | BLOCK_EXPR
+                | RECORD_LIT
+        )
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -386,10 +376,7 @@ pub struct ExprStmt {
 
 impl AstNode for ExprStmt {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            EXPR_STMT => true,
-            _ => false,
-        }
+        matches!(kind, EXPR_STMT)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -417,10 +404,7 @@ pub struct FieldExpr {
 
 impl AstNode for FieldExpr {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            FIELD_EXPR => true,
-            _ => false,
-        }
+        matches!(kind, FIELD_EXPR)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -452,10 +436,7 @@ pub struct FunctionDef {
 
 impl AstNode for FunctionDef {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            FUNCTION_DEF => true,
-            _ => false,
-        }
+        matches!(kind, FUNCTION_DEF)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -495,10 +476,7 @@ pub struct IfExpr {
 
 impl AstNode for IfExpr {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            IF_EXPR => true,
-            _ => false,
-        }
+        matches!(kind, IF_EXPR)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -526,10 +504,7 @@ pub struct LetStmt {
 
 impl AstNode for LetStmt {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            LET_STMT => true,
-            _ => false,
-        }
+        matches!(kind, LET_STMT)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -562,10 +537,7 @@ pub struct Literal {
 
 impl AstNode for Literal {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            LITERAL => true,
-            _ => false,
-        }
+        matches!(kind, LITERAL)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -589,10 +561,7 @@ pub struct LoopExpr {
 
 impl AstNode for LoopExpr {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            LOOP_EXPR => true,
-            _ => false,
-        }
+        matches!(kind, LOOP_EXPR)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -617,10 +586,7 @@ pub struct MemoryTypeSpecifier {
 
 impl AstNode for MemoryTypeSpecifier {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            MEMORY_TYPE_SPECIFIER => true,
-            _ => false,
-        }
+        matches!(kind, MEMORY_TYPE_SPECIFIER)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -644,10 +610,7 @@ pub struct ModuleItem {
 
 impl AstNode for ModuleItem {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            FUNCTION_DEF | STRUCT_DEF | TYPE_ALIAS_DEF => true,
-            _ => false,
-        }
+        matches!(kind, FUNCTION_DEF | STRUCT_DEF | TYPE_ALIAS_DEF)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -708,10 +671,7 @@ pub struct Name {
 
 impl AstNode for Name {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            NAME => true,
-            _ => false,
-        }
+        matches!(kind, NAME)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -735,10 +695,7 @@ pub struct NameRef {
 
 impl AstNode for NameRef {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            NAME_REF => true,
-            _ => false,
-        }
+        matches!(kind, NAME_REF)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -762,10 +719,7 @@ pub struct NeverType {
 
 impl AstNode for NeverType {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            NEVER_TYPE => true,
-            _ => false,
-        }
+        matches!(kind, NEVER_TYPE)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -789,10 +743,7 @@ pub struct Param {
 
 impl AstNode for Param {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            PARAM => true,
-            _ => false,
-        }
+        matches!(kind, PARAM)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -821,10 +772,7 @@ pub struct ParamList {
 
 impl AstNode for ParamList {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            PARAM_LIST => true,
-            _ => false,
-        }
+        matches!(kind, PARAM_LIST)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -852,10 +800,7 @@ pub struct ParenExpr {
 
 impl AstNode for ParenExpr {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            PAREN_EXPR => true,
-            _ => false,
-        }
+        matches!(kind, PAREN_EXPR)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -883,10 +828,7 @@ pub struct Pat {
 
 impl AstNode for Pat {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            BIND_PAT | PLACEHOLDER_PAT => true,
-            _ => false,
-        }
+        matches!(kind, BIND_PAT | PLACEHOLDER_PAT)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -938,10 +880,7 @@ pub struct Path {
 
 impl AstNode for Path {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            PATH => true,
-            _ => false,
-        }
+        matches!(kind, PATH)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -973,10 +912,7 @@ pub struct PathExpr {
 
 impl AstNode for PathExpr {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            PATH_EXPR => true,
-            _ => false,
-        }
+        matches!(kind, PATH_EXPR)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1004,10 +940,7 @@ pub struct PathSegment {
 
 impl AstNode for PathSegment {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            PATH_SEGMENT => true,
-            _ => false,
-        }
+        matches!(kind, PATH_SEGMENT)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1035,10 +968,7 @@ pub struct PathType {
 
 impl AstNode for PathType {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            PATH_TYPE => true,
-            _ => false,
-        }
+        matches!(kind, PATH_TYPE)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1066,10 +996,7 @@ pub struct PlaceholderPat {
 
 impl AstNode for PlaceholderPat {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            PLACEHOLDER_PAT => true,
-            _ => false,
-        }
+        matches!(kind, PLACEHOLDER_PAT)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1093,10 +1020,7 @@ pub struct PrefixExpr {
 
 impl AstNode for PrefixExpr {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            PREFIX_EXPR => true,
-            _ => false,
-        }
+        matches!(kind, PREFIX_EXPR)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1124,10 +1048,7 @@ pub struct RecordField {
 
 impl AstNode for RecordField {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            RECORD_FIELD => true,
-            _ => false,
-        }
+        matches!(kind, RECORD_FIELD)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1159,10 +1080,7 @@ pub struct RecordFieldDef {
 
 impl AstNode for RecordFieldDef {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            RECORD_FIELD_DEF => true,
-            _ => false,
-        }
+        matches!(kind, RECORD_FIELD_DEF)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1190,10 +1108,7 @@ pub struct RecordFieldDefList {
 
 impl AstNode for RecordFieldDefList {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            RECORD_FIELD_DEF_LIST => true,
-            _ => false,
-        }
+        matches!(kind, RECORD_FIELD_DEF_LIST)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1221,10 +1136,7 @@ pub struct RecordFieldList {
 
 impl AstNode for RecordFieldList {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            RECORD_FIELD_LIST => true,
-            _ => false,
-        }
+        matches!(kind, RECORD_FIELD_LIST)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1256,10 +1168,7 @@ pub struct RecordLit {
 
 impl AstNode for RecordLit {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            RECORD_LIT => true,
-            _ => false,
-        }
+        matches!(kind, RECORD_LIT)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1291,10 +1200,7 @@ pub struct RetType {
 
 impl AstNode for RetType {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            RET_TYPE => true,
-            _ => false,
-        }
+        matches!(kind, RET_TYPE)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1322,10 +1228,7 @@ pub struct ReturnExpr {
 
 impl AstNode for ReturnExpr {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            RETURN_EXPR => true,
-            _ => false,
-        }
+        matches!(kind, RETURN_EXPR)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1353,10 +1256,7 @@ pub struct SourceFile {
 
 impl AstNode for SourceFile {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            SOURCE_FILE => true,
-            _ => false,
-        }
+        matches!(kind, SOURCE_FILE)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1382,10 +1282,7 @@ pub struct Stmt {
 
 impl AstNode for Stmt {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            LET_STMT | EXPR_STMT => true,
-            _ => false,
-        }
+        matches!(kind, LET_STMT | EXPR_STMT)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1435,10 +1332,7 @@ pub struct StructDef {
 
 impl AstNode for StructDef {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            STRUCT_DEF => true,
-            _ => false,
-        }
+        matches!(kind, STRUCT_DEF)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1469,10 +1363,7 @@ pub struct TupleFieldDef {
 
 impl AstNode for TupleFieldDef {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            TUPLE_FIELD_DEF => true,
-            _ => false,
-        }
+        matches!(kind, TUPLE_FIELD_DEF)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1501,10 +1392,7 @@ pub struct TupleFieldDefList {
 
 impl AstNode for TupleFieldDefList {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            TUPLE_FIELD_DEF_LIST => true,
-            _ => false,
-        }
+        matches!(kind, TUPLE_FIELD_DEF_LIST)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1532,10 +1420,7 @@ pub struct TypeAliasDef {
 
 impl AstNode for TypeAliasDef {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            TYPE_ALIAS_DEF => true,
-            _ => false,
-        }
+        matches!(kind, TYPE_ALIAS_DEF)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1565,10 +1450,7 @@ pub struct TypeRef {
 
 impl AstNode for TypeRef {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            PATH_TYPE | NEVER_TYPE => true,
-            _ => false,
-        }
+        matches!(kind, PATH_TYPE | NEVER_TYPE)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1618,10 +1500,7 @@ pub struct Visibility {
 
 impl AstNode for Visibility {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            VISIBILITY => true,
-            _ => false,
-        }
+        matches!(kind, VISIBILITY)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -1645,10 +1524,7 @@ pub struct WhileExpr {
 
 impl AstNode for WhileExpr {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
-            WHILE_EXPR => true,
-            _ => false,
-        }
+        matches!(kind, WHILE_EXPR)
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
diff --git a/crates/mun_syntax/src/ast/generated.rs.tera b/crates/mun_syntax/src/ast/generated.rs.tera
index b88305d96..685ff08b4 100644
--- a/crates/mun_syntax/src/ast/generated.rs.tera
+++ b/crates/mun_syntax/src/ast/generated.rs.tera
@@ -24,14 +24,13 @@ pub struct {{ node }} {
 
 impl AstNode for {{ node }} {
     fn can_cast(kind: SyntaxKind) -> bool {
-        match kind {
+        matches!(kind,
             {%- if methods.enum %}
-            {% for kind in methods.enum %} | {{ kind | SCREAM }} {%- endfor -%}
+            {% for kind in methods.enum %} {%  if loop.index > 1 %}| {% endif %}{{ kind | SCREAM }} {%- endfor -%}
             {% else %}
             {{ node | SCREAM }}
-            {%- endif %} => true,
-            _ => false,
-        }
+            {%- endif %}
+        )
     }
     fn cast(syntax: SyntaxNode) -> Option<Self> {
         if Self::can_cast(syntax.kind()) {
@@ -109,4 +108,4 @@ impl {{ node }} {
 {%- endif -%}
 }
 
-{% endfor %}
\ No newline at end of file
+{% endfor %}
diff --git a/crates/mun_syntax/src/parsing/grammar/paths.rs b/crates/mun_syntax/src/parsing/grammar/paths.rs
index bd048dc42..cc22c9691 100644
--- a/crates/mun_syntax/src/parsing/grammar/paths.rs
+++ b/crates/mun_syntax/src/parsing/grammar/paths.rs
@@ -3,10 +3,7 @@ use super::*;
 pub(super) const PATH_FIRST: TokenSet = token_set![IDENT, SELF_KW, SUPER_KW, COLONCOLON];
 
 pub(super) fn is_path_start(p: &Parser) -> bool {
-    match p.current() {
-        IDENT | T![::] => true,
-        _ => false,
-    }
+    matches!(p.current(), IDENT | T![::])
 }
 
 pub(super) fn type_path(p: &mut Parser) {
@@ -27,10 +24,7 @@ fn path(p: &mut Parser, mode: Mode) {
     path_segment(p, mode, true);
     let mut qualifier = path.complete(p, PATH);
     loop {
-        let import_tree = match p.nth(1) {
-            T![*] | T!['{'] => true,
-            _ => false,
-        };
+        let import_tree = matches!(p.nth(1), T![*] | T!['{']);
         if p.at(T![::]) && !import_tree {
             let path = qualifier.precede(p);
             p.bump(T![::]);
diff --git a/crates/mun_syntax/src/syntax_kind.rs b/crates/mun_syntax/src/syntax_kind.rs
index 666a70faf..2c409c1e8 100644
--- a/crates/mun_syntax/src/syntax_kind.rs
+++ b/crates/mun_syntax/src/syntax_kind.rs
@@ -17,9 +17,6 @@ pub(crate) struct SyntaxInfo {
 
 impl SyntaxKind {
     pub fn is_trivia(self) -> bool {
-        match self {
-            SyntaxKind::WHITESPACE | SyntaxKind::COMMENT => true,
-            _ => false,
-        }
+        matches!(self, SyntaxKind::WHITESPACE | SyntaxKind::COMMENT)
     }
 }
diff --git a/crates/mun_syntax/src/syntax_kind/generated.rs b/crates/mun_syntax/src/syntax_kind/generated.rs
index 1d9b58173..5f512f872 100644
--- a/crates/mun_syntax/src/syntax_kind/generated.rs
+++ b/crates/mun_syntax/src/syntax_kind/generated.rs
@@ -380,100 +380,94 @@ impl From<SyntaxKind> for u16 {
 impl SyntaxKind {
     #[rustfmt::skip]
     pub fn is_keyword(self) -> bool {
-        match self {
-            | BREAK_KW
-            | DO_KW
-            | ELSE_KW
-            | FALSE_KW
-            | FOR_KW
-            | FN_KW
-            | IF_KW
-            | IN_KW
-            | NIL_KW
-            | RETURN_KW
-            | TRUE_KW
-            | WHILE_KW
-            | LOOP_KW
-            | LET_KW
-            | MUT_KW
-            | CLASS_KW
-            | STRUCT_KW
-            | NEVER_KW
-            | PUB_KW
-            | TYPE_KW
-            | PACKAGE_KW
-            | SUPER_KW
-            | SELF_KW
-            | EXTERN_KW
-                => true,
-            _ => false
-        }
+        matches!(self,
+        BREAK_KW
+        | DO_KW
+        | ELSE_KW
+        | FALSE_KW
+        | FOR_KW
+        | FN_KW
+        | IF_KW
+        | IN_KW
+        | NIL_KW
+        | RETURN_KW
+        | TRUE_KW
+        | WHILE_KW
+        | LOOP_KW
+        | LET_KW
+        | MUT_KW
+        | CLASS_KW
+        | STRUCT_KW
+        | NEVER_KW
+        | PUB_KW
+        | TYPE_KW
+        | PACKAGE_KW
+        | SUPER_KW
+        | SELF_KW
+        | EXTERN_KW
+        )
     }
 
     #[rustfmt::skip]
     pub fn is_symbol(self) -> bool {
-            match self {
-                | AMP
-                | PIPE
-                | PLUS
-                | MINUS
-                | STAR
-                | SLASH
-                | PERCENT
-                | CARET
-                | HASH
-                | DOT
-                | LT
-                | GT
-                | EQ
-                | L_PAREN
-                | R_PAREN
-                | L_CURLY
-                | R_CURLY
-                | L_BRACKET
-                | R_BRACKET
-                | SEMI
-                | COLON
-                | COMMA
-                | EXCLAMATION
-                | UNDERSCORE
-                | EQEQ
-                | NEQ
-                | LTEQ
-                | GTEQ
-                | DOTDOT
-                | DOTDOTDOT
-                | PLUSEQ
-                | MINUSEQ
-                | STAREQ
-                | SLASHEQ
-                | PERCENTEQ
-                | SHLEQ
-                | SHREQ
-                | AMPEQ
-                | PIPEEQ
-                | CARETEQ
-                | DOTDOTEQ
-                | COLONCOLON
-                | THIN_ARROW
-                | AMPAMP
-                | PIPEPIPE
-                | SHL
-                | SHR
-                    => true,
-                _ => false
-            }
+        matches!(self,
+        AMP
+        | PIPE
+        | PLUS
+        | MINUS
+        | STAR
+        | SLASH
+        | PERCENT
+        | CARET
+        | HASH
+        | DOT
+        | LT
+        | GT
+        | EQ
+        | L_PAREN
+        | R_PAREN
+        | L_CURLY
+        | R_CURLY
+        | L_BRACKET
+        | R_BRACKET
+        | SEMI
+        | COLON
+        | COMMA
+        | EXCLAMATION
+        | UNDERSCORE
+        | EQEQ
+        | NEQ
+        | LTEQ
+        | GTEQ
+        | DOTDOT
+        | DOTDOTDOT
+        | PLUSEQ
+        | MINUSEQ
+        | STAREQ
+        | SLASHEQ
+        | PERCENTEQ
+        | SHLEQ
+        | SHREQ
+        | AMPEQ
+        | PIPEEQ
+        | CARETEQ
+        | DOTDOTEQ
+        | COLONCOLON
+        | THIN_ARROW
+        | AMPAMP
+        | PIPEPIPE
+        | SHL
+        | SHR
+        )
     }
 
     #[rustfmt::skip]
     pub fn is_literal(self) -> bool {
-            match self {
-                | INT_NUMBER
-                | FLOAT_NUMBER
-                | STRING
-                    => true,
-                _ => false
-            }
+        matches!(self,
+            INT_NUMBER
+            | FLOAT_NUMBER
+            | STRING
+        )
     }
 
     #[rustfmt::skip]
diff --git a/crates/mun_syntax/src/syntax_kind/generated.rs.tera b/crates/mun_syntax/src/syntax_kind/generated.rs.tera
index da29a542c..1348c15a0 100644
--- a/crates/mun_syntax/src/syntax_kind/generated.rs.tera
+++ b/crates/mun_syntax/src/syntax_kind/generated.rs.tera
@@ -70,35 +70,29 @@ impl From<SyntaxKind> for u16 {
 impl SyntaxKind {
     #[rustfmt::skip]
     pub fn is_keyword(self) -> bool {
-        match self {
+        matches!(self,
 {%- for kw in keywords %}
-            | {{kw | upper}}_KW
+        {%  if loop.index > 1 %}| {% endif %}{{kw | upper}}_KW
 {%- endfor %}
-                => true,
-            _ => false
-        }
+        )
     }
 
     #[rustfmt::skip]
     pub fn is_symbol(self) -> bool {
-            match self {
+        matches!(self,
     {%- for t in concat(a=single_char_tokens, b=multi_char_tokens) %}
-                | {{t.1}}
+        {%  if loop.index > 1 %}| {% endif %}{{t.1}}
     {%- endfor %}
-                    => true,
-                _ => false
-            }
+        )
     }
 
     #[rustfmt::skip]
     pub fn is_literal(self) -> bool {
-            match self {
+        matches!(self,
     {%- for t in literals %}
-                | {{t}}
+            {%  if loop.index > 1 %}| {% endif %}{{t}}
     {%- endfor %}
-                    => true,
-                _ => false
-            }
+        )
     }
 
     #[rustfmt::skip]
diff --git a/rust-toolchain b/rust-toolchain
index 0a3db35b2..21998d3c2 100644
--- a/rust-toolchain
+++ b/rust-toolchain
@@ -1,1 +1,1 @@
-1.46.0
+1.47.0


Test patch: