Skip to content

Commit

Permalink
Bump clippy::version for some lints
Browse files Browse the repository at this point in the history
Also moves `tuple_array_conversions` to `pedantic`, because #11171 didn't contain it fsr
  • Loading branch information
Centri3 committed Jul 25, 2023
1 parent 18a942c commit 94ecccb
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 26 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/error_impl_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ declare_clippy_lint! {
///
/// impl std::error::Error for Error { ... }
/// ```
#[clippy::version = "1.72.0"]
#[clippy::version = "1.73.0"]
pub ERROR_IMPL_ERROR,
restriction,
"exported types named `Error` that implement `Error`"
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/excessive_nesting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ declare_clippy_lint! {
/// // lib.rs
/// pub mod a;
/// ```
#[clippy::version = "1.70.0"]
#[clippy::version = "1.72.0"]
pub EXCESSIVE_NESTING,
complexity,
"checks for blocks nested beyond a certain threshold"
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/four_forward_slashes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ declare_clippy_lint! {
/// // ...
/// }
/// ```
#[clippy::version = "1.72.0"]
#[clippy::version = "1.73.0"]
pub FOUR_FORWARD_SLASHES,
suspicious,
"comments with 4 forward slashes (`////`) likely intended to be doc comments (`///`)"
Expand Down
7 changes: 4 additions & 3 deletions clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3363,6 +3363,7 @@ declare_clippy_lint! {
}

declare_clippy_lint! {
/// ### What it does
/// Looks for calls to [`Stdin::read_line`] to read a line from the standard input
/// into a string, then later attempting to parse this string into a type without first trimming it, which will
/// always fail because the string has a trailing newline in it.
Expand Down Expand Up @@ -3413,7 +3414,7 @@ declare_clippy_lint! {
/// # let c = 'c';
/// matches!(c, '\\' | '.' | '+' | '*' | '(' | ')' | '|' | '[' | ']' | '{' | '}' | '^' | '$' | '#' | '&' | '-' | '~');
/// ```
#[clippy::version = "1.72.0"]
#[clippy::version = "1.73.0"]
pub STRING_LIT_CHARS_ANY,
restriction,
"checks for `<string_lit>.chars().any(|i| i == c)`"
Expand Down Expand Up @@ -3448,7 +3449,7 @@ declare_clippy_lint! {
/// })
/// }
/// ```
#[clippy::version = "1.72.0"]
#[clippy::version = "1.73.0"]
pub FORMAT_COLLECT,
perf,
"`format!`ing every element in a collection, then collecting the strings into a new `String`"
Expand All @@ -3469,7 +3470,7 @@ declare_clippy_lint! {
/// let y = v.iter().collect::<Vec<_>>();
/// assert_eq!(x, y);
/// ```
#[clippy::version = "1.72.0"]
#[clippy::version = "1.73.0"]
pub ITER_SKIP_ZERO,
correctness,
"disallows `.skip(0)`"
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/needless_pass_by_ref_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessPassByRefMut<'tcx> {
diag.warn("changing this function will impact semver compatibility");
}
if *is_cfged {
diag.note("this is cfg-gated and may require further changes");
diag.note("this is `cfg`-gated and may require further changes");
}
},
);
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/tuple_array_conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ declare_clippy_lint! {
/// ```
#[clippy::version = "1.72.0"]
pub TUPLE_ARRAY_CONVERSIONS,
nursery,
pedantic,
"checks for tuple<=>array conversions that are not done with `.into()`"
}
impl_lint_pass!(TupleArrayConversions => [TUPLE_ARRAY_CONVERSIONS]);
Expand Down
32 changes: 16 additions & 16 deletions tests/ui/needless_pass_by_ref_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use std::ptr::NonNull;

fn foo(s: &mut Vec<u32>, b: &u32, x: &mut u32) {
//~^ ERROR: this argument is a mutable reference, but not used mutably
//~^ ERROR: this argument is a mutable reference, but never used mutably
*x += *b + s.len() as u32;
}

Expand All @@ -29,7 +29,7 @@ fn foo5(s: &mut Vec<u32>) {
}

fn foo6(s: &mut Vec<u32>) {
//~^ ERROR: this argument is a mutable reference, but not used mutably
//~^ ERROR: this argument is a mutable reference, but never used mutably
non_mut_ref(s);
}

Expand All @@ -42,12 +42,12 @@ impl Bar {
fn bar(&mut self) {}

fn mushroom(&self, vec: &mut Vec<i32>) -> usize {
//~^ ERROR: this argument is a mutable reference, but not used mutably
//~^ ERROR: this argument is a mutable reference, but never used mutably
vec.len()
}

fn badger(&mut self, vec: &mut Vec<i32>) -> usize {
//~^ ERROR: this argument is a mutable reference, but not used mutably
//~^ ERROR: this argument is a mutable reference, but never used mutably
vec.len()
}
}
Expand Down Expand Up @@ -124,35 +124,35 @@ async fn f7(x: &mut i32, y: i32, z: &mut i32, a: i32) {
}

async fn a1(x: &mut i32) {
//~^ ERROR: this argument is a mutable reference, but not used mutably
//~^ ERROR: this argument is a mutable reference, but never used mutably
println!("{:?}", x);
}
async fn a2(x: &mut i32, y: String) {
//~^ ERROR: this argument is a mutable reference, but not used mutably
//~^ ERROR: this argument is a mutable reference, but never used mutably
println!("{:?}", x);
}
async fn a3(x: &mut i32, y: String, z: String) {
//~^ ERROR: this argument is a mutable reference, but not used mutably
//~^ ERROR: this argument is a mutable reference, but never used mutably
println!("{:?}", x);
}
async fn a4(x: &mut i32, y: i32) {
//~^ ERROR: this argument is a mutable reference, but not used mutably
//~^ ERROR: this argument is a mutable reference, but never used mutably
println!("{:?}", x);
}
async fn a5(x: i32, y: &mut i32) {
//~^ ERROR: this argument is a mutable reference, but not used mutably
//~^ ERROR: this argument is a mutable reference, but never used mutably
println!("{:?}", x);
}
async fn a6(x: i32, y: &mut i32) {
//~^ ERROR: this argument is a mutable reference, but not used mutably
//~^ ERROR: this argument is a mutable reference, but never used mutably
println!("{:?}", x);
}
async fn a7(x: i32, y: i32, z: &mut i32) {
//~^ ERROR: this argument is a mutable reference, but not used mutably
//~^ ERROR: this argument is a mutable reference, but never used mutably
println!("{:?}", z);
}
async fn a8(x: i32, a: &mut i32, y: i32, z: &mut i32) {
//~^ ERROR: this argument is a mutable reference, but not used mutably
//~^ ERROR: this argument is a mutable reference, but never used mutably
println!("{:?}", z);
}

Expand Down Expand Up @@ -186,14 +186,14 @@ fn lint_attr(s: &mut u32) {}

#[cfg(not(feature = "a"))]
fn cfg_warn(s: &mut u32) {}
//~^ ERROR: this argument is a mutable reference, but not used mutably
//~| NOTE: this is cfg-gated and may require further changes
//~^ ERROR: this argument is a mutable reference, but never used mutably
//~| NOTE: this is `cfg`-gated and may require further changes

#[cfg(not(feature = "a"))]
mod foo {
fn cfg_warn(s: &mut u32) {}
//~^ ERROR: this argument is a mutable reference, but not used mutably
//~| NOTE: this is cfg-gated and may require further changes
//~^ ERROR: this argument is a mutable reference, but never used mutably
//~| NOTE: this is `cfg`-gated and may require further changes
}

fn main() {
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/needless_pass_by_ref_mut.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ error: this argument is a mutable reference, but never used mutably
LL | fn cfg_warn(s: &mut u32) {}
| ^^^^^^^^ help: consider using an immutable reference instead: `&u32`
|
= note: this is cfg-gated and may require further changes
= note: this is `cfg`-gated and may require further changes

error: this argument is a mutable reference, but never used mutably
--> $DIR/needless_pass_by_ref_mut.rs:194:20
|
LL | fn cfg_warn(s: &mut u32) {}
| ^^^^^^^^ help: consider using an immutable reference instead: `&u32`
|
= note: this is cfg-gated and may require further changes
= note: this is `cfg`-gated and may require further changes

error: aborting due to 15 previous errors

0 comments on commit 94ecccb

Please sign in to comment.