Skip to content

Commit c66d35e

Browse files
committed
update if let to match in universal_regions.rs
Signed-off-by: xizheyin <[email protected]>
1 parent a8b0eb7 commit c66d35e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Diff for: compiler/rustc_borrowck/src/universal_regions.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -909,19 +909,19 @@ impl<'tcx> UniversalRegionIndices<'tcx> {
909909
/// if it is a placeholder. Handling placeholders requires access to the
910910
/// `MirTypeckRegionConstraints`.
911911
fn to_region_vid(&self, r: ty::Region<'tcx>) -> RegionVid {
912-
if let ty::ReVar(..) = r.kind() {
913-
r.as_var()
914-
} else if let ty::ReError(guar) = r.kind() {
915-
self.tainted_by_errors.set(Some(guar));
916-
// We use the `'static` `RegionVid` because `ReError` doesn't actually exist in the
917-
// `UniversalRegionIndices`. This is fine because 1) it is a fallback only used if
918-
// errors are being emitted and 2) it leaves the happy path unaffected.
919-
self.fr_static
920-
} else {
921-
*self
912+
match r.kind() {
913+
ty::ReVar(..) => r.as_var(),
914+
ty::ReError(guar) => {
915+
self.tainted_by_errors.set(Some(guar));
916+
// We use the `'static` `RegionVid` because `ReError` doesn't actually exist in the
917+
// `UniversalRegionIndices`. This is fine because 1) it is a fallback only used if
918+
// errors are being emitted and 2) it leaves the happy path unaffected.
919+
self.fr_static
920+
}
921+
_ => *self
922922
.indices
923923
.get(&r)
924-
.unwrap_or_else(|| bug!("cannot convert `{:?}` to a region vid", r))
924+
.unwrap_or_else(|| bug!("cannot convert `{:?}` to a region vid", r)),
925925
}
926926
}
927927

0 commit comments

Comments
 (0)