Skip to content

Commit d3f6573

Browse files
1 parent 6ad39e5 commit d3f6573

8 files changed

+11
-56
lines changed

src/tools/clippy/clippy_lints/src/needless_pass_by_ref_mut.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ declare_clippy_lint! {
4646
/// ```
4747
#[clippy::version = "1.72.0"]
4848
pub NEEDLESS_PASS_BY_REF_MUT,
49-
suspicious,
49+
nursery,
5050
"using a `&mut` argument when it's not mutated"
5151
}
5252

src/tools/clippy/tests/ui/infinite_loop.stderr

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,5 @@ LL | while y < 10 {
9191
= note: this loop contains `return`s or `break`s
9292
= help: rewrite it as `if cond { loop { } }`
9393

94-
error: this argument is a mutable reference, but not used mutably
95-
--> $DIR/infinite_loop.rs:7:17
96-
|
97-
LL | fn fn_mutref(i: &mut i32) {
98-
| ^^^^^^^^ help: consider changing to: `&i32`
99-
|
100-
= note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings`
101-
102-
error: aborting due to 12 previous errors
94+
error: aborting due to 11 previous errors
10395

src/tools/clippy/tests/ui/let_underscore_future.stderr

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,5 @@ LL | let _ = future;
2323
|
2424
= help: consider awaiting the future or dropping explicitly with `std::mem::drop`
2525

26-
error: this argument is a mutable reference, but not used mutably
27-
--> $DIR/let_underscore_future.rs:11:35
28-
|
29-
LL | fn do_something_to_future(future: &mut impl Future<Output = ()>) {}
30-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&impl Future<Output = ()>`
31-
|
32-
= note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings`
33-
34-
error: aborting due to 4 previous errors
26+
error: aborting due to 3 previous errors
3527

src/tools/clippy/tests/ui/mut_key.stderr

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,5 @@ error: mutable key type
102102
LL | let _map = HashMap::<Arc<Cell<usize>>, usize>::new();
103103
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104104

105-
error: this argument is a mutable reference, but not used mutably
106-
--> $DIR/mut_key.rs:31:32
107-
|
108-
LL | fn should_not_take_this_arg(m: &mut HashMap<Key, usize>, _n: usize) -> HashSet<Key> {
109-
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&HashMap<Key, usize>`
110-
|
111-
= note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings`
112-
113-
error: aborting due to 18 previous errors
105+
error: aborting due to 17 previous errors
114106

src/tools/clippy/tests/ui/mut_reference.stderr

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,5 @@ error: the method `takes_an_immutable_reference` doesn't need a mutable referenc
1818
LL | my_struct.takes_an_immutable_reference(&mut 42);
1919
| ^^^^^^^
2020

21-
error: this argument is a mutable reference, but not used mutably
22-
--> $DIR/mut_reference.rs:24:44
23-
|
24-
LL | fn takes_a_mutable_reference(&self, a: &mut i32) {}
25-
| ^^^^^^^^ help: consider changing to: `&i32`
26-
|
27-
= note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings`
28-
29-
error: aborting due to 4 previous errors
21+
error: aborting due to 3 previous errors
3022

src/tools/clippy/tests/ui/needless_pass_by_ref_mut.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#![allow(clippy::if_same_then_else, clippy::no_effect)]
22
#![feature(lint_reasons)]
33

4+
// just ignore everywhere for now
5+
//@ignore-32bit
6+
//@ignore-64bit
7+
48
use std::ptr::NonNull;
59

610
fn foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) {

src/tools/clippy/tests/ui/should_impl_trait/method_list_2.stderr

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,5 @@ LL | | }
149149
|
150150
= help: consider implementing the trait `std::ops::Sub` or choosing a less ambiguous method name
151151

152-
error: this argument is a mutable reference, but not used mutably
153-
--> $DIR/method_list_2.rs:38:31
154-
|
155-
LL | pub fn hash(&self, state: &mut T) {
156-
| ^^^^^^ help: consider changing to: `&T`
157-
|
158-
= warning: changing this function will impact semver compatibility
159-
= note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings`
160-
161-
error: aborting due to 16 previous errors
152+
error: aborting due to 15 previous errors
162153

src/tools/clippy/tests/ui/slow_vector_initialization.stderr

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,5 @@ LL | vec1 = Vec::new();
9696
LL | vec1.resize(10, 0);
9797
| ^^^^^^^^^^^^^^^^^^
9898

99-
error: this argument is a mutable reference, but not used mutably
100-
--> $DIR/slow_vector_initialization.rs:78:18
101-
|
102-
LL | fn do_stuff(vec: &mut [u8]) {}
103-
| ^^^^^^^^^ help: consider changing to: `&[u8]`
104-
|
105-
= note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings`
106-
107-
error: aborting due to 13 previous errors
99+
error: aborting due to 12 previous errors
108100

0 commit comments

Comments
 (0)