Skip to content

Commit 8245718

Browse files
committed
and more
warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_mir_transform\src\coroutine.rs:1229:11 | 1229 | body: &mut Body<'tcx>, | ^^^^^^^^^^^^^^^ help: consider changing to: `&Body<'tcx>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_mir_transform\src\nrvo.rs:123:11 | 123 | body: &mut mir::Body<'_>, | ^^^^^^^^^^^^^^^^^^ help: consider changing to: `&mir::Body<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_mir_transform\src\nrvo.rs:87:34 | 87 | fn local_eligible_for_nrvo(body: &mut mir::Body<'_>) -> Option<Local> { | ^^^^^^^^^^^^^^^^^^ help: consider changing to: `&mir::Body<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
1 parent 9a6b3df commit 8245718

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

compiler/rustc_mir_build/src/build/matches/mod.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1595,10 +1595,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
15951595
/// [`Switch`]: TestKind::Switch
15961596
/// [`SwitchInt`]: TestKind::SwitchInt
15971597
/// [`Range`]: TestKind::Range
1598-
fn pick_test(
1599-
&mut self,
1600-
candidates: &mut [&mut Candidate<'_, 'tcx>],
1601-
) -> (Place<'tcx>, Test<'tcx>) {
1598+
fn pick_test(&mut self, candidates: &[&mut Candidate<'_, 'tcx>]) -> (Place<'tcx>, Test<'tcx>) {
16021599
// Extract the match-pair from the highest priority candidate
16031600
let match_pair = &candidates.first().unwrap().match_pairs[0];
16041601
let test = self.test(match_pair);

compiler/rustc_mir_transform/src/coroutine.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ fn create_coroutine_drop_shim<'tcx>(
12261226
tcx: TyCtxt<'tcx>,
12271227
transform: &TransformVisitor<'tcx>,
12281228
coroutine_ty: Ty<'tcx>,
1229-
body: &mut Body<'tcx>,
1229+
body: &Body<'tcx>,
12301230
drop_clean: BasicBlock,
12311231
) -> Body<'tcx> {
12321232
let mut body = body.clone();

compiler/rustc_mir_transform/src/nrvo.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<'tcx> MirPass<'tcx> for RenameReturnPlace {
8484
///
8585
/// If the MIR fulfills both these conditions, this function returns the `Local` that is assigned
8686
/// to the return place along all possible paths through the control-flow graph.
87-
fn local_eligible_for_nrvo(body: &mut mir::Body<'_>) -> Option<Local> {
87+
fn local_eligible_for_nrvo(body: &mir::Body<'_>) -> Option<Local> {
8888
if IsReturnPlaceRead::run(body) {
8989
return None;
9090
}
@@ -118,10 +118,7 @@ fn local_eligible_for_nrvo(body: &mut mir::Body<'_>) -> Option<Local> {
118118
copied_to_return_place
119119
}
120120

121-
fn find_local_assigned_to_return_place(
122-
start: BasicBlock,
123-
body: &mut mir::Body<'_>,
124-
) -> Option<Local> {
121+
fn find_local_assigned_to_return_place(start: BasicBlock, body: &mir::Body<'_>) -> Option<Local> {
125122
let mut block = start;
126123
let mut seen = BitSet::new_empty(body.basic_blocks.len());
127124

0 commit comments

Comments
 (0)