Skip to content

Commit

Permalink
Add run-rustfix for rename test
Browse files Browse the repository at this point in the history
I removed the `Bar` static and `Foo` impl because they are not needed
for what's tested here as far as I can tell.
  • Loading branch information
phansch committed Aug 19, 2019
1 parent 6860bc3 commit a17ea1c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 12 deletions.
20 changes: 20 additions & 0 deletions tests/ui/rename.fixed
Original file line number Diff line number Diff line change
@@ -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() {}
10 changes: 3 additions & 7 deletions tests/ui/rename.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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() {}
10 changes: 5 additions & 5 deletions tests/ui/rename.stderr
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
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`
|
= 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`
Expand Down

0 comments on commit a17ea1c

Please sign in to comment.