mirror of
https://github.com/rust-lang/rust.git
synced 2026-01-25 07:48:44 +00:00
This commit is contained in:
@@ -46,7 +46,7 @@ declare_clippy_lint! {
|
||||
/// ```
|
||||
#[clippy::version = "1.72.0"]
|
||||
pub NEEDLESS_PASS_BY_REF_MUT,
|
||||
suspicious,
|
||||
nursery,
|
||||
"using a `&mut` argument when it's not mutated"
|
||||
}
|
||||
|
||||
|
||||
@@ -91,13 +91,5 @@ LL | while y < 10 {
|
||||
= note: this loop contains `return`s or `break`s
|
||||
= help: rewrite it as `if cond { loop { } }`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> $DIR/infinite_loop.rs:7:17
|
||||
|
|
||||
LL | fn fn_mutref(i: &mut i32) {
|
||||
| ^^^^^^^^ help: consider changing to: `&i32`
|
||||
|
|
||||
= note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 12 previous errors
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
|
||||
@@ -23,13 +23,5 @@ LL | let _ = future;
|
||||
|
|
||||
= help: consider awaiting the future or dropping explicitly with `std::mem::drop`
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> $DIR/let_underscore_future.rs:11:35
|
||||
|
|
||||
LL | fn do_something_to_future(future: &mut impl Future<Output = ()>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&impl Future<Output = ()>`
|
||||
|
|
||||
= note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
||||
@@ -102,13 +102,5 @@ error: mutable key type
|
||||
LL | let _map = HashMap::<Arc<Cell<usize>>, usize>::new();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> $DIR/mut_key.rs:31:32
|
||||
|
|
||||
LL | fn should_not_take_this_arg(m: &mut HashMap<Key, usize>, _n: usize) -> HashSet<Key> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&HashMap<Key, usize>`
|
||||
|
|
||||
= note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 18 previous errors
|
||||
error: aborting due to 17 previous errors
|
||||
|
||||
|
||||
@@ -18,13 +18,5 @@ error: the method `takes_an_immutable_reference` doesn't need a mutable referenc
|
||||
LL | my_struct.takes_an_immutable_reference(&mut 42);
|
||||
| ^^^^^^^
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> $DIR/mut_reference.rs:24:44
|
||||
|
|
||||
LL | fn takes_a_mutable_reference(&self, a: &mut i32) {}
|
||||
| ^^^^^^^^ help: consider changing to: `&i32`
|
||||
|
|
||||
= note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#![allow(clippy::if_same_then_else, clippy::no_effect)]
|
||||
#![feature(lint_reasons)]
|
||||
|
||||
// just ignore everywhere for now
|
||||
//@ignore-32bit
|
||||
//@ignore-64bit
|
||||
|
||||
use std::ptr::NonNull;
|
||||
|
||||
fn foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) {
|
||||
|
||||
@@ -149,14 +149,5 @@ LL | | }
|
||||
|
|
||||
= help: consider implementing the trait `std::ops::Sub` or choosing a less ambiguous method name
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> $DIR/method_list_2.rs:38:31
|
||||
|
|
||||
LL | pub fn hash(&self, state: &mut T) {
|
||||
| ^^^^^^ help: consider changing to: `&T`
|
||||
|
|
||||
= warning: changing this function will impact semver compatibility
|
||||
= note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 16 previous errors
|
||||
error: aborting due to 15 previous errors
|
||||
|
||||
|
||||
@@ -96,13 +96,5 @@ LL | vec1 = Vec::new();
|
||||
LL | vec1.resize(10, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: this argument is a mutable reference, but not used mutably
|
||||
--> $DIR/slow_vector_initialization.rs:78:18
|
||||
|
|
||||
LL | fn do_stuff(vec: &mut [u8]) {}
|
||||
| ^^^^^^^^^ help: consider changing to: `&[u8]`
|
||||
|
|
||||
= note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings`
|
||||
|
||||
error: aborting due to 13 previous errors
|
||||
error: aborting due to 12 previous errors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user