Skip to content

Commit 6ffc20f

Browse files
committed
Use if let here
1 parent 98edaea commit 6ffc20f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/librustc_mir/borrow_check/place_ext.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> {
5757

5858
if *elem == ProjectionElem::Deref {
5959
let ty = Place::ty_from(&self.base, proj_base, body, tcx).ty;
60-
match ty.sty {
60+
if let ty::RawPtr(..) | ty::Ref(_, _, hir::MutImmutable) = ty.sty {
6161
// For both derefs of raw pointers and `&T`
6262
// references, the original path is `Copy` and
6363
// therefore not significant. In particular,
@@ -68,8 +68,7 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> {
6868
// original path into a new variable and
6969
// borrowed *that* one, leaving the original
7070
// path unborrowed.
71-
ty::RawPtr(..) | ty::Ref(_, _, hir::MutImmutable) => return true,
72-
_ => {}
71+
return true;
7372
}
7473
}
7574
}

0 commit comments

Comments
 (0)