Skip to content

Commit

Permalink
Use if let here
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Sep 13, 2019
1 parent 98edaea commit 6ffc20f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/librustc_mir/borrow_check/place_ext.rs
Expand Up @@ -57,7 +57,7 @@ impl<'tcx> PlaceExt<'tcx> for Place<'tcx> {

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

0 comments on commit 6ffc20f

Please sign in to comment.