Skip to content

Commit 57c4678

Browse files
committed
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...)
1 parent d0416cc commit 57c4678

File tree

1 file changed

+4
-4
lines changed
  • src/librustc_mir/borrow_check

1 file changed

+4
-4
lines changed

Diff for: src/librustc_mir/borrow_check/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1943,7 +1943,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
19431943
}
19441944
}
19451945

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

0 commit comments

Comments
 (0)