about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src
diff options
context:
space:
mode:
authorLingMan <LingMan@users.noreply.github.com>2020-12-29 01:20:06 +0100
committerLingMan <LingMan@users.noreply.github.com>2020-12-29 17:18:52 +0100
commit7a41532ef900cf6b1adbbafde93f489147f1cbca (patch)
tree5859583b5a4a2f6f3ce04c7cedff16cb68436ab7 /compiler/rustc_ast_lowering/src
parent2987785df3d46d5ff144a5c67fbb8f5cca798d78 (diff)
downloadrust-7a41532ef900cf6b1adbbafde93f489147f1cbca.tar.gz
rust-7a41532ef900cf6b1adbbafde93f489147f1cbca.zip
More uses of the matches! macro
Diffstat (limited to 'compiler/rustc_ast_lowering/src')
-rw-r--r--compiler/rustc_ast_lowering/src/lib.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs
index 2e1b5a74a7b..5bcfe2fedee 100644
--- a/compiler/rustc_ast_lowering/src/lib.rs
+++ b/compiler/rustc_ast_lowering/src/lib.rs
@@ -1806,12 +1806,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
             output,
             c_variadic,
             implicit_self: decl.inputs.get(0).map_or(hir::ImplicitSelfKind::None, |arg| {
-                let is_mutable_pat = match arg.pat.kind {
-                    PatKind::Ident(BindingMode::ByValue(mt) | BindingMode::ByRef(mt), _, _) => {
-                        mt == Mutability::Mut
-                    }
-                    _ => false,
-                };
+                use BindingMode::{ByRef, ByValue};
+                let is_mutable_pat = matches!(
+                    arg.pat.kind,
+                    PatKind::Ident(ByValue(Mutability::Mut) | ByRef(Mutability::Mut), ..)
+                );
 
                 match arg.ty.kind {
                     TyKind::ImplicitSelf if is_mutable_pat => hir::ImplicitSelfKind::Mut,