From a17ea1c97de3e04f08a571bc9e5d6b7719fdc9ec Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Sun, 18 Aug 2019 09:37:12 +0200 Subject: [PATCH] Add run-rustfix for rename test I removed the `Bar` static and `Foo` impl because they are not needed for what's tested here as far as I can tell. --- tests/ui/rename.fixed | 20 ++++++++++++++++++++ tests/ui/rename.rs | 10 +++------- tests/ui/rename.stderr | 10 +++++----- 3 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 tests/ui/rename.fixed diff --git a/tests/ui/rename.fixed b/tests/ui/rename.fixed new file mode 100644 index 000000000000..947914aa123f --- /dev/null +++ b/tests/ui/rename.fixed @@ -0,0 +1,20 @@ +//! Test for Clippy lint renames. +// run-rustfix + +#![allow(dead_code)] +// allow the new lint name here, to test if the new name works +#![allow(clippy::module_name_repetitions)] +#![allow(clippy::new_without_default)] +#![allow(clippy::cognitive_complexity)] +#![allow(clippy::redundant_static_lifetimes)] +// warn for the old lint name here, to test if the renaming worked +#![warn(clippy::cognitive_complexity)] + +#[warn(clippy::module_name_repetitions)] +fn main() {} + +#[warn(clippy::new_without_default)] +struct Foo; + +#[warn(clippy::redundant_static_lifetimes)] +fn foo() {} diff --git a/tests/ui/rename.rs b/tests/ui/rename.rs index f3758174125a..e2c8c223fc77 100644 --- a/tests/ui/rename.rs +++ b/tests/ui/rename.rs @@ -1,5 +1,7 @@ //! Test for Clippy lint renames. +// run-rustfix +#![allow(dead_code)] // allow the new lint name here, to test if the new name works #![allow(clippy::module_name_repetitions)] #![allow(clippy::new_without_default)] @@ -15,10 +17,4 @@ fn main() {} struct Foo; #[warn(clippy::const_static_lifetime)] -static Bar: &'static str = "baz"; - -impl Foo { - fn new() -> Self { - Foo - } -} +fn foo() {} diff --git a/tests/ui/rename.stderr b/tests/ui/rename.stderr index 0765e6e954a1..83c7f26ba5fa 100644 --- a/tests/ui/rename.stderr +++ b/tests/ui/rename.stderr @@ -1,5 +1,5 @@ error: lint `clippy::cyclomatic_complexity` has been renamed to `clippy::cognitive_complexity` - --> $DIR/rename.rs:9:9 + --> $DIR/rename.rs:11:9 | LL | #![warn(clippy::cyclomatic_complexity)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::cognitive_complexity` @@ -7,25 +7,25 @@ LL | #![warn(clippy::cyclomatic_complexity)] = note: `-D renamed-and-removed-lints` implied by `-D warnings` error: lint `clippy::stutter` has been renamed to `clippy::module_name_repetitions` - --> $DIR/rename.rs:11:8 + --> $DIR/rename.rs:13:8 | LL | #[warn(clippy::stutter)] | ^^^^^^^^^^^^^^^ help: use the new name: `clippy::module_name_repetitions` error: lint `clippy::new_without_default_derive` has been renamed to `clippy::new_without_default` - --> $DIR/rename.rs:14:8 + --> $DIR/rename.rs:16:8 | LL | #[warn(clippy::new_without_default_derive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::new_without_default` error: lint `clippy::const_static_lifetime` has been renamed to `clippy::redundant_static_lifetimes` - --> $DIR/rename.rs:17:8 + --> $DIR/rename.rs:19:8 | LL | #[warn(clippy::const_static_lifetime)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::redundant_static_lifetimes` error: lint `clippy::cyclomatic_complexity` has been renamed to `clippy::cognitive_complexity` - --> $DIR/rename.rs:9:9 + --> $DIR/rename.rs:11:9 | LL | #![warn(clippy::cyclomatic_complexity)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::cognitive_complexity`