diff options
| author | LingMan <LingMan@users.noreply.github.com> | 2020-12-29 01:20:06 +0100 |
|---|---|---|
| committer | LingMan <LingMan@users.noreply.github.com> | 2020-12-29 17:18:52 +0100 |
| commit | 7a41532ef900cf6b1adbbafde93f489147f1cbca (patch) | |
| tree | 5859583b5a4a2f6f3ce04c7cedff16cb68436ab7 /compiler/rustc_ast_lowering/src | |
| parent | 2987785df3d46d5ff144a5c67fbb8f5cca798d78 (diff) | |
| download | rust-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.rs | 11 |
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, |
