From 57c467824bf72e0346fc7bc7140e232664c4e891 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Tue, 16 Oct 2018 15:50:44 +0200 Subject: [PATCH] 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...) --- src/librustc_mir/borrow_check/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index f9a1e1e11082..ae79394dfebe 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -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, - }); + }) } } }