From 86ce182b5a4c4e87189ac0c22fb2516b46f9fad1 Mon Sep 17 00:00:00 2001 From: Catherine Flores Date: Wed, 19 Jul 2023 04:46:41 -0500 Subject: [PATCH] Bump `clippy::version` for some lints Also moves `tuple_array_conversions` to `pedantic`, because #11171 didn't contain it fsr --- clippy_lints/src/error_impl_error.rs | 2 +- clippy_lints/src/excessive_nesting.rs | 2 +- clippy_lints/src/four_forward_slashes.rs | 2 +- clippy_lints/src/methods/mod.rs | 7 +++-- clippy_lints/src/needless_pass_by_ref_mut.rs | 2 +- clippy_lints/src/tuple_array_conversions.rs | 2 +- tests/ui/needless_pass_by_ref_mut.rs | 32 ++++++++++---------- tests/ui/needless_pass_by_ref_mut.stderr | 4 +-- 8 files changed, 27 insertions(+), 26 deletions(-) diff --git a/clippy_lints/src/error_impl_error.rs b/clippy_lints/src/error_impl_error.rs index 379af9b2234c..486a0bdde5b4 100644 --- a/clippy_lints/src/error_impl_error.rs +++ b/clippy_lints/src/error_impl_error.rs @@ -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`" diff --git a/clippy_lints/src/excessive_nesting.rs b/clippy_lints/src/excessive_nesting.rs index 8911f1872c2c..83480fc5eebe 100644 --- a/clippy_lints/src/excessive_nesting.rs +++ b/clippy_lints/src/excessive_nesting.rs @@ -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" diff --git a/clippy_lints/src/four_forward_slashes.rs b/clippy_lints/src/four_forward_slashes.rs index 419c77343441..0ec52f89e716 100644 --- a/clippy_lints/src/four_forward_slashes.rs +++ b/clippy_lints/src/four_forward_slashes.rs @@ -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 (`///`)" diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index dd694ce7393e..33a5bc9d32f0 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -3365,6 +3365,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. @@ -3415,7 +3416,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 `.chars().any(|i| i == c)`" @@ -3450,7 +3451,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`" @@ -3471,7 +3472,7 @@ declare_clippy_lint! { /// let y = v.iter().collect::>(); /// assert_eq!(x, y); /// ``` - #[clippy::version = "1.72.0"] + #[clippy::version = "1.73.0"] pub ITER_SKIP_ZERO, correctness, "disallows `.skip(0)`" diff --git a/clippy_lints/src/needless_pass_by_ref_mut.rs b/clippy_lints/src/needless_pass_by_ref_mut.rs index 077c147de1d3..dbd58392b768 100644 --- a/clippy_lints/src/needless_pass_by_ref_mut.rs +++ b/clippy_lints/src/needless_pass_by_ref_mut.rs @@ -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"); } }, ); diff --git a/clippy_lints/src/tuple_array_conversions.rs b/clippy_lints/src/tuple_array_conversions.rs index 7eec69820924..791cbe2fead7 100644 --- a/clippy_lints/src/tuple_array_conversions.rs +++ b/clippy_lints/src/tuple_array_conversions.rs @@ -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]); diff --git a/tests/ui/needless_pass_by_ref_mut.rs b/tests/ui/needless_pass_by_ref_mut.rs index ae7b018d0e25..0e6a3dfbd8c5 100644 --- a/tests/ui/needless_pass_by_ref_mut.rs +++ b/tests/ui/needless_pass_by_ref_mut.rs @@ -4,7 +4,7 @@ use std::ptr::NonNull; fn foo(s: &mut Vec, 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; } @@ -29,7 +29,7 @@ fn foo5(s: &mut Vec) { } fn foo6(s: &mut Vec) { - //~^ 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); } @@ -42,12 +42,12 @@ impl Bar { fn bar(&mut self) {} fn mushroom(&self, vec: &mut Vec) -> 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) -> 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() } } @@ -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); } @@ -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() { diff --git a/tests/ui/needless_pass_by_ref_mut.stderr b/tests/ui/needless_pass_by_ref_mut.stderr index 756be15af94f..c78e3e1d0791 100644 --- a/tests/ui/needless_pass_by_ref_mut.stderr +++ b/tests/ui/needless_pass_by_ref_mut.stderr @@ -84,7 +84,7 @@ 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 @@ -92,7 +92,7 @@ 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: aborting due to 15 previous errors