Skip to content

Commit

Permalink
Use if let instead of match
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Mar 23, 2019
1 parent f94f85b commit 5032643
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit 5032643

Please sign in to comment.