forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#7657 - dswij:needless-borrow-mut, r=llogiq
`needless_borrow` checks for mutable borrow closes rust-lang#7635 changelog: [`needless_borrow`] now checks for needless mutable borrow
- Loading branch information
Showing
4 changed files
with
51 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
error: this expression borrows a reference (`&i32`) that is immediately dereferenced by the compiler | ||
--> $DIR/needless_borrow.rs:14:15 | ||
--> $DIR/needless_borrow.rs:8:15 | ||
| | ||
LL | let c = x(&&a); | ||
LL | let _ = x(&&a); // warn | ||
| ^^^ help: change this to: `&a` | ||
| | ||
= note: `-D clippy::needless-borrow` implied by `-D warnings` | ||
|
||
error: this expression borrows a reference (`&mut i32`) that is immediately dereferenced by the compiler | ||
--> $DIR/needless_borrow.rs:12:13 | ||
| | ||
LL | mut_ref(&mut &mut b); // warn | ||
| ^^^^^^^^^^^ help: change this to: `&mut b` | ||
|
||
error: this expression borrows a reference (`&i32`) that is immediately dereferenced by the compiler | ||
--> $DIR/needless_borrow.rs:27:15 | ||
--> $DIR/needless_borrow.rs:26:15 | ||
| | ||
LL | 46 => &&a, | ||
| ^^^ help: change this to: `&a` | ||
|
||
error: aborting due to 2 previous errors | ||
error: aborting due to 3 previous errors | ||
|