From 5032643538da3e121a940438623adf820f95ae64 Mon Sep 17 00:00:00 2001 From: varkor Date: Sat, 23 Mar 2019 13:05:36 +0000 Subject: [PATCH] Use `if let` instead of `match` --- src/librustc_resolve/lib.rs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index c9b9898fb4132..6929d920219a2 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -951,7 +951,7 @@ enum RibKind<'a> { TraitOrImplItemRibKind, /// We passed through a function definition. Disallow upvars. - /// Permit only those const parameters specified in the function's generics. + /// Permit only those const parameters that are specified in the function's generics. FnItemRibKind, /// We passed through an item scope. Disallow upvars. @@ -3924,19 +3924,16 @@ impl<'a> Resolver<'a> { ribs.next(); } for rib in ribs { - match rib.kind { - ItemRibKind | FnItemRibKind => { - // This was an attempt to use a const parameter outside its scope. - if record_used { - resolve_error( - self, - span, - ResolutionError::GenericParamsFromOuterFunction(def), - ); - } - return Def::Err; + if let ItemRibKind | FnItemRibKind = rib.kind { + // This was an attempt to use a const parameter outside its scope. + if record_used { + resolve_error( + self, + span, + ResolutionError::GenericParamsFromOuterFunction(def), + ); } - _ => {} + return Def::Err; } } }