Skip to content

Commit 5032643

Browse files
committed
Use if let instead of match
1 parent f94f85b commit 5032643

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

src/librustc_resolve/lib.rs

+10-13
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ enum RibKind<'a> {
951951
TraitOrImplItemRibKind,
952952

953953
/// We passed through a function definition. Disallow upvars.
954-
/// Permit only those const parameters specified in the function's generics.
954+
/// Permit only those const parameters that are specified in the function's generics.
955955
FnItemRibKind,
956956

957957
/// We passed through an item scope. Disallow upvars.
@@ -3924,19 +3924,16 @@ impl<'a> Resolver<'a> {
39243924
ribs.next();
39253925
}
39263926
for rib in ribs {
3927-
match rib.kind {
3928-
ItemRibKind | FnItemRibKind => {
3929-
// This was an attempt to use a const parameter outside its scope.
3930-
if record_used {
3931-
resolve_error(
3932-
self,
3933-
span,
3934-
ResolutionError::GenericParamsFromOuterFunction(def),
3935-
);
3936-
}
3937-
return Def::Err;
3927+
if let ItemRibKind | FnItemRibKind = rib.kind {
3928+
// This was an attempt to use a const parameter outside its scope.
3929+
if record_used {
3930+
resolve_error(
3931+
self,
3932+
span,
3933+
ResolutionError::GenericParamsFromOuterFunction(def),
3934+
);
39383935
}
3939-
_ => {}
3936+
return Def::Err;
39403937
}
39413938
}
39423939
}

0 commit comments

Comments
 (0)