Cleanup fn is_mutable by removing some unnecessary control-flow breaks.

(This makes it a little easier to add instrumentation of the entry and
exit by adding `debug!` at the beginning and end, though note that the
function body *does* use the `?` operator...)
This commit is contained in:
Felix S. Klock II 2018-10-16 15:50:44 +02:00
parent d0416cc093
commit 57c467824b

View File

@ -1943,7 +1943,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
}
}
/// Whether this value be written or borrowed mutably.
/// Whether this value can be written or borrowed mutably.
/// Returns the root place if the place passed in is a projection.
fn is_mutable<'d>(
&self,
@ -2021,14 +2021,14 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
ty::RawPtr(tnm) => {
match tnm.mutbl {
// `*const` raw pointers are not mutable
hir::MutImmutable => return Err(place),
hir::MutImmutable => Err(place),
// `*mut` raw pointers are always mutable, regardless of
// context. The users have to check by themselves.
hir::MutMutable => {
return Ok(RootPlace {
Ok(RootPlace {
place,
is_local_mutation_allowed,
});
})
}
}
}