diff --git a/src/librustc_passes/dead.rs b/src/librustc_passes/dead.rs index f2aef2c12c7df..9ad63f28a8e16 100644 --- a/src/librustc_passes/dead.rs +++ b/src/librustc_passes/dead.rs @@ -578,7 +578,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> { hir::ItemKind::Struct(..) | hir::ItemKind::Union(..) | hir::ItemKind::Trait(..) | - hir::ItemKind::Impl(..) => self.tcx.sess.source_map().def_span(item.span), + hir::ItemKind::Impl(..) => item.ident.span, _ => item.span, }; let participle = match item.kind { diff --git a/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr b/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr index c6d198dc458a6..5ab3dfb24496f 100644 --- a/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr +++ b/src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr @@ -7,10 +7,10 @@ LL | #![plugin(lint_plugin_test)] = note: `#[warn(deprecated)]` on by default warning: function is never used: `lintme` - --> $DIR/lint-plugin-cmdline-allow.rs:10:1 + --> $DIR/lint-plugin-cmdline-allow.rs:10:4 | LL | fn lintme() { } - | ^^^^^^^^^^^ + | ^^^^^^ | note: lint level defined here --> $DIR/lint-plugin-cmdline-allow.rs:7:9 diff --git a/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr b/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr index 239732521d59e..3a9fd7c2867f2 100644 --- a/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr +++ b/src/test/ui-fulldeps/lint-tool-cmdline-allow.stderr @@ -19,10 +19,10 @@ LL | fn lintme() {} = note: `#[warn(clippy::test_lint)]` on by default warning: function is never used: `lintme` - --> $DIR/lint-tool-cmdline-allow.rs:10:1 + --> $DIR/lint-tool-cmdline-allow.rs:10:4 | LL | fn lintme() {} - | ^^^^^^^^^^^ + | ^^^^^^ | note: lint level defined here --> $DIR/lint-tool-cmdline-allow.rs:7:9 diff --git a/src/test/ui/dead-code-alias-in-pat.rs b/src/test/ui/lint/dead-code/alias-in-pat.rs similarity index 100% rename from src/test/ui/dead-code-alias-in-pat.rs rename to src/test/ui/lint/dead-code/alias-in-pat.rs diff --git a/src/test/ui/lint-dead-code-associated-type.rs b/src/test/ui/lint/dead-code/associated-type.rs similarity index 100% rename from src/test/ui/lint-dead-code-associated-type.rs rename to src/test/ui/lint/dead-code/associated-type.rs diff --git a/src/test/ui/fail-no-dead-code.rs b/src/test/ui/lint/dead-code/basic.rs similarity index 100% rename from src/test/ui/fail-no-dead-code.rs rename to src/test/ui/lint/dead-code/basic.rs diff --git a/src/test/ui/fail-no-dead-code.stderr b/src/test/ui/lint/dead-code/basic.stderr similarity index 68% rename from src/test/ui/fail-no-dead-code.stderr rename to src/test/ui/lint/dead-code/basic.stderr index 8babcffaa8dd7..194398e5a07a5 100644 --- a/src/test/ui/fail-no-dead-code.stderr +++ b/src/test/ui/lint/dead-code/basic.stderr @@ -1,11 +1,11 @@ error: function is never used: `foo` - --> $DIR/fail-no-dead-code.rs:4:1 + --> $DIR/basic.rs:4:4 | LL | fn foo() { - | ^^^^^^^^ + | ^^^ | note: lint level defined here - --> $DIR/fail-no-dead-code.rs:1:9 + --> $DIR/basic.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ diff --git a/src/test/ui/dead-code-closure-bang.rs b/src/test/ui/lint/dead-code/closure-bang.rs similarity index 100% rename from src/test/ui/dead-code-closure-bang.rs rename to src/test/ui/lint/dead-code/closure-bang.rs diff --git a/src/test/ui/lint/lint-dead-code-const-and-self.rs b/src/test/ui/lint/dead-code/const-and-self.rs similarity index 100% rename from src/test/ui/lint/lint-dead-code-const-and-self.rs rename to src/test/ui/lint/dead-code/const-and-self.rs diff --git a/src/test/ui/lint/lint-dead-code-empty-unused-enum.rs b/src/test/ui/lint/dead-code/empty-unused-enum.rs similarity index 100% rename from src/test/ui/lint/lint-dead-code-empty-unused-enum.rs rename to src/test/ui/lint/dead-code/empty-unused-enum.rs diff --git a/src/test/ui/lint/lint-dead-code-empty-unused-enum.stderr b/src/test/ui/lint/dead-code/empty-unused-enum.stderr similarity index 67% rename from src/test/ui/lint/lint-dead-code-empty-unused-enum.stderr rename to src/test/ui/lint/dead-code/empty-unused-enum.stderr index 4e3bebfc48bde..44b0a8f613e27 100644 --- a/src/test/ui/lint/lint-dead-code-empty-unused-enum.stderr +++ b/src/test/ui/lint/dead-code/empty-unused-enum.stderr @@ -1,11 +1,11 @@ error: enum is never used: `E` - --> $DIR/lint-dead-code-empty-unused-enum.rs:3:1 + --> $DIR/empty-unused-enum.rs:3:6 | LL | enum E {} - | ^^^^^^ + | ^ | note: lint level defined here - --> $DIR/lint-dead-code-empty-unused-enum.rs:1:9 + --> $DIR/empty-unused-enum.rs:1:9 | LL | #![deny(unused)] | ^^^^^^ diff --git a/src/test/ui/lint/lint-dead-code-empty-unused-enum-pub.rs b/src/test/ui/lint/dead-code/empty-unused-public-enum.rs similarity index 100% rename from src/test/ui/lint/lint-dead-code-empty-unused-enum-pub.rs rename to src/test/ui/lint/dead-code/empty-unused-public-enum.rs diff --git a/src/test/ui/lint-dead-code-variant.rs b/src/test/ui/lint/dead-code/enum-variants.rs similarity index 100% rename from src/test/ui/lint-dead-code-variant.rs rename to src/test/ui/lint/dead-code/enum-variants.rs diff --git a/src/test/ui/lint/lint-dead-code-impl-trait.rs b/src/test/ui/lint/dead-code/impl-trait.rs similarity index 100% rename from src/test/ui/lint/lint-dead-code-impl-trait.rs rename to src/test/ui/lint/dead-code/impl-trait.rs diff --git a/src/test/ui/lint/lint-dead-code-impl-trait.stderr b/src/test/ui/lint/dead-code/impl-trait.stderr similarity index 71% rename from src/test/ui/lint/lint-dead-code-impl-trait.stderr rename to src/test/ui/lint/dead-code/impl-trait.stderr index 61d0954bf3146..f2a78cc65e26e 100644 --- a/src/test/ui/lint/lint-dead-code-impl-trait.stderr +++ b/src/test/ui/lint/dead-code/impl-trait.stderr @@ -1,11 +1,11 @@ error: type alias is never used: `Unused` - --> $DIR/lint-dead-code-impl-trait.rs:12:1 + --> $DIR/impl-trait.rs:12:1 | LL | type Unused = (); | ^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-dead-code-impl-trait.rs:1:9 + --> $DIR/impl-trait.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ diff --git a/src/test/ui/dead-code-leading-underscore.rs b/src/test/ui/lint/dead-code/leading-underscore.rs similarity index 100% rename from src/test/ui/dead-code-leading-underscore.rs rename to src/test/ui/lint/dead-code/leading-underscore.rs diff --git a/src/test/ui/lint/lint-dead-code-1.rs b/src/test/ui/lint/dead-code/lint-dead-code-1.rs similarity index 100% rename from src/test/ui/lint/lint-dead-code-1.rs rename to src/test/ui/lint/dead-code/lint-dead-code-1.rs diff --git a/src/test/ui/lint/lint-dead-code-1.stderr b/src/test/ui/lint/dead-code/lint-dead-code-1.stderr similarity index 73% rename from src/test/ui/lint/lint-dead-code-1.stderr rename to src/test/ui/lint/dead-code/lint-dead-code-1.stderr index be96c697d9944..bac46a2e843cd 100644 --- a/src/test/ui/lint/lint-dead-code-1.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-1.stderr @@ -1,8 +1,8 @@ error: struct is never constructed: `Bar` - --> $DIR/lint-dead-code-1.rs:12:5 + --> $DIR/lint-dead-code-1.rs:12:16 | LL | pub struct Bar; - | ^^^^^^^^^^^^^^^ + | ^^^ | note: lint level defined here --> $DIR/lint-dead-code-1.rs:5:9 @@ -23,16 +23,16 @@ LL | const priv_const: isize = 0; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: struct is never constructed: `PrivStruct` - --> $DIR/lint-dead-code-1.rs:35:1 + --> $DIR/lint-dead-code-1.rs:35:8 | LL | struct PrivStruct; - | ^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^ error: enum is never used: `priv_enum` - --> $DIR/lint-dead-code-1.rs:64:1 + --> $DIR/lint-dead-code-1.rs:64:6 | LL | enum priv_enum { foo2, bar2 } - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^ error: variant is never constructed: `bar3` --> $DIR/lint-dead-code-1.rs:67:5 @@ -41,28 +41,28 @@ LL | bar3 | ^^^^ error: function is never used: `priv_fn` - --> $DIR/lint-dead-code-1.rs:88:1 + --> $DIR/lint-dead-code-1.rs:88:4 | LL | fn priv_fn() { - | ^^^^^^^^^^^^ + | ^^^^^^^ error: function is never used: `foo` - --> $DIR/lint-dead-code-1.rs:93:1 + --> $DIR/lint-dead-code-1.rs:93:4 | LL | fn foo() { - | ^^^^^^^^ + | ^^^ error: function is never used: `bar` - --> $DIR/lint-dead-code-1.rs:98:1 + --> $DIR/lint-dead-code-1.rs:98:4 | LL | fn bar() { - | ^^^^^^^^ + | ^^^ error: function is never used: `baz` - --> $DIR/lint-dead-code-1.rs:102:1 + --> $DIR/lint-dead-code-1.rs:102:4 | LL | fn baz() -> impl Copy { - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^ error: aborting due to 10 previous errors diff --git a/src/test/ui/lint/lint-dead-code-2.rs b/src/test/ui/lint/dead-code/lint-dead-code-2.rs similarity index 100% rename from src/test/ui/lint/lint-dead-code-2.rs rename to src/test/ui/lint/dead-code/lint-dead-code-2.rs diff --git a/src/test/ui/lint/lint-dead-code-2.stderr b/src/test/ui/lint/dead-code/lint-dead-code-2.stderr similarity index 69% rename from src/test/ui/lint/lint-dead-code-2.stderr rename to src/test/ui/lint/dead-code/lint-dead-code-2.stderr index 1226f9823ac54..a578a76d9a075 100644 --- a/src/test/ui/lint/lint-dead-code-2.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-2.stderr @@ -1,8 +1,8 @@ error: function is never used: `dead_fn` - --> $DIR/lint-dead-code-2.rs:22:1 + --> $DIR/lint-dead-code-2.rs:22:4 | LL | fn dead_fn() {} - | ^^^^^^^^^^^^ + | ^^^^^^^ | note: lint level defined here --> $DIR/lint-dead-code-2.rs:2:9 @@ -11,16 +11,16 @@ LL | #![deny(dead_code)] | ^^^^^^^^^ error: function is never used: `dead_fn2` - --> $DIR/lint-dead-code-2.rs:25:1 + --> $DIR/lint-dead-code-2.rs:25:4 | LL | fn dead_fn2() {} - | ^^^^^^^^^^^^^ + | ^^^^^^^^ error: function is never used: `main` - --> $DIR/lint-dead-code-2.rs:38:1 + --> $DIR/lint-dead-code-2.rs:38:4 | LL | fn main() { - | ^^^^^^^^^ + | ^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/lint/lint-dead-code-3.rs b/src/test/ui/lint/dead-code/lint-dead-code-3.rs similarity index 100% rename from src/test/ui/lint/lint-dead-code-3.rs rename to src/test/ui/lint/dead-code/lint-dead-code-3.rs diff --git a/src/test/ui/lint/lint-dead-code-3.stderr b/src/test/ui/lint/dead-code/lint-dead-code-3.stderr similarity index 80% rename from src/test/ui/lint/lint-dead-code-3.stderr rename to src/test/ui/lint/dead-code/lint-dead-code-3.stderr index 2408da0af89ea..569196fffdd50 100644 --- a/src/test/ui/lint/lint-dead-code-3.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-3.stderr @@ -1,8 +1,8 @@ error: struct is never constructed: `Foo` - --> $DIR/lint-dead-code-3.rs:13:1 + --> $DIR/lint-dead-code-3.rs:13:8 | LL | struct Foo; - | ^^^^^^^^^^^ + | ^^^ | note: lint level defined here --> $DIR/lint-dead-code-3.rs:3:9 @@ -17,16 +17,16 @@ LL | fn foo(&self) { | ^^^^^^^^^^^^^ error: function is never used: `bar` - --> $DIR/lint-dead-code-3.rs:20:1 + --> $DIR/lint-dead-code-3.rs:20:4 | LL | fn bar() { - | ^^^^^^^^ + | ^^^ error: enum is never used: `c_void` - --> $DIR/lint-dead-code-3.rs:59:1 + --> $DIR/lint-dead-code-3.rs:59:6 | LL | enum c_void {} - | ^^^^^^^^^^^ + | ^^^^^^ error: foreign function is never used: `free` --> $DIR/lint-dead-code-3.rs:61:5 diff --git a/src/test/ui/lint/lint-dead-code-4.rs b/src/test/ui/lint/dead-code/lint-dead-code-4.rs similarity index 100% rename from src/test/ui/lint/lint-dead-code-4.rs rename to src/test/ui/lint/dead-code/lint-dead-code-4.rs diff --git a/src/test/ui/lint/lint-dead-code-4.stderr b/src/test/ui/lint/dead-code/lint-dead-code-4.stderr similarity index 96% rename from src/test/ui/lint/lint-dead-code-4.stderr rename to src/test/ui/lint/dead-code/lint-dead-code-4.stderr index b7ceee99998d7..8eaf789f8f793 100644 --- a/src/test/ui/lint/lint-dead-code-4.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-4.stderr @@ -27,10 +27,10 @@ LL | | }, | |_____^ error: enum is never used: `ABC` - --> $DIR/lint-dead-code-4.rs:24:1 + --> $DIR/lint-dead-code-4.rs:24:6 | LL | enum ABC { - | ^^^^^^^^ + | ^^^ error: variant is never constructed: `I` --> $DIR/lint-dead-code-4.rs:36:5 diff --git a/src/test/ui/lint/lint-dead-code-5.rs b/src/test/ui/lint/dead-code/lint-dead-code-5.rs similarity index 100% rename from src/test/ui/lint/lint-dead-code-5.rs rename to src/test/ui/lint/dead-code/lint-dead-code-5.rs diff --git a/src/test/ui/lint/lint-dead-code-5.stderr b/src/test/ui/lint/dead-code/lint-dead-code-5.stderr similarity index 92% rename from src/test/ui/lint/lint-dead-code-5.stderr rename to src/test/ui/lint/dead-code/lint-dead-code-5.stderr index 740cfde2c069f..9670d8e7a32e3 100644 --- a/src/test/ui/lint/lint-dead-code-5.stderr +++ b/src/test/ui/lint/dead-code/lint-dead-code-5.stderr @@ -23,10 +23,10 @@ LL | Variant6(isize), | ^^^^^^^^^^^^^^^ error: enum is never used: `Enum3` - --> $DIR/lint-dead-code-5.rs:18:1 + --> $DIR/lint-dead-code-5.rs:18:6 | LL | enum Enum3 { - | ^^^^^^^^^^ + | ^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/lint/dead-code/newline-span.rs b/src/test/ui/lint/dead-code/newline-span.rs new file mode 100644 index 0000000000000..a4342056419d7 --- /dev/null +++ b/src/test/ui/lint/dead-code/newline-span.rs @@ -0,0 +1,19 @@ +#![deny(dead_code)] + +fn unused() { //~ error: function is never used: + println!("blah"); +} + +fn unused2(var: i32) { //~ error: function is never used: + println!("foo {}", var); +} + +fn unused3( //~ error: function is never used: + var: i32, +) { + println!("bar {}", var); +} + +fn main() { + println!("Hello world!"); +} diff --git a/src/test/ui/lint/dead-code/newline-span.stderr b/src/test/ui/lint/dead-code/newline-span.stderr new file mode 100644 index 0000000000000..c5d0d60506744 --- /dev/null +++ b/src/test/ui/lint/dead-code/newline-span.stderr @@ -0,0 +1,26 @@ +error: function is never used: `unused` + --> $DIR/newline-span.rs:3:4 + | +LL | fn unused() { + | ^^^^^^ + | +note: lint level defined here + --> $DIR/newline-span.rs:1:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: function is never used: `unused2` + --> $DIR/newline-span.rs:7:4 + | +LL | fn unused2(var: i32) { + | ^^^^^^^ + +error: function is never used: `unused3` + --> $DIR/newline-span.rs:11:4 + | +LL | fn unused3( + | ^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/dead-code-tuple-struct-field.rs b/src/test/ui/lint/dead-code/tuple-struct-field.rs similarity index 100% rename from src/test/ui/dead-code-tuple-struct-field.rs rename to src/test/ui/lint/dead-code/tuple-struct-field.rs diff --git a/src/test/ui/lint/lint-dead-code-type-alias.rs b/src/test/ui/lint/dead-code/type-alias.rs similarity index 100% rename from src/test/ui/lint/lint-dead-code-type-alias.rs rename to src/test/ui/lint/dead-code/type-alias.rs diff --git a/src/test/ui/lint/lint-dead-code-type-alias.stderr b/src/test/ui/lint/dead-code/type-alias.stderr similarity index 71% rename from src/test/ui/lint/lint-dead-code-type-alias.stderr rename to src/test/ui/lint/dead-code/type-alias.stderr index 4198ddfb6cb03..82df23bd9448b 100644 --- a/src/test/ui/lint/lint-dead-code-type-alias.stderr +++ b/src/test/ui/lint/dead-code/type-alias.stderr @@ -1,11 +1,11 @@ error: type alias is never used: `Unused` - --> $DIR/lint-dead-code-type-alias.rs:4:1 + --> $DIR/type-alias.rs:4:1 | LL | type Unused = u8; | ^^^^^^^^^^^^^^^^^ | note: lint level defined here - --> $DIR/lint-dead-code-type-alias.rs:1:9 + --> $DIR/type-alias.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ diff --git a/src/test/ui/lint/lint-dead-code-unused-enum.rs b/src/test/ui/lint/dead-code/unused-enum.rs similarity index 100% rename from src/test/ui/lint/lint-dead-code-unused-enum.rs rename to src/test/ui/lint/dead-code/unused-enum.rs diff --git a/src/test/ui/lint/lint-dead-code-unused-enum.stderr b/src/test/ui/lint/dead-code/unused-enum.stderr similarity index 61% rename from src/test/ui/lint/lint-dead-code-unused-enum.stderr rename to src/test/ui/lint/dead-code/unused-enum.stderr index ea711e7b05ee6..142c2ccb99b05 100644 --- a/src/test/ui/lint/lint-dead-code-unused-enum.stderr +++ b/src/test/ui/lint/dead-code/unused-enum.stderr @@ -1,27 +1,27 @@ error: struct is never constructed: `F` - --> $DIR/lint-dead-code-unused-enum.rs:3:1 + --> $DIR/unused-enum.rs:3:8 | LL | struct F; - | ^^^^^^^^^ + | ^ | note: lint level defined here - --> $DIR/lint-dead-code-unused-enum.rs:1:9 + --> $DIR/unused-enum.rs:1:9 | LL | #![deny(unused)] | ^^^^^^ = note: `#[deny(dead_code)]` implied by `#[deny(unused)]` error: struct is never constructed: `B` - --> $DIR/lint-dead-code-unused-enum.rs:4:1 + --> $DIR/unused-enum.rs:4:8 | LL | struct B; - | ^^^^^^^^^ + | ^ error: enum is never used: `E` - --> $DIR/lint-dead-code-unused-enum.rs:6:1 + --> $DIR/unused-enum.rs:6:6 | LL | enum E { - | ^^^^^^ + | ^ error: aborting due to 3 previous errors diff --git a/src/test/ui/lint/lint-dead-code-unused-variant.rs b/src/test/ui/lint/dead-code/unused-struct-variant.rs similarity index 100% rename from src/test/ui/lint/lint-dead-code-unused-variant.rs rename to src/test/ui/lint/dead-code/unused-struct-variant.rs diff --git a/src/test/ui/lint/lint-dead-code-unused-variant.stderr b/src/test/ui/lint/dead-code/unused-struct-variant.stderr similarity index 73% rename from src/test/ui/lint/lint-dead-code-unused-variant.stderr rename to src/test/ui/lint/dead-code/unused-struct-variant.stderr index 919996ec30020..0037592e3de06 100644 --- a/src/test/ui/lint/lint-dead-code-unused-variant.stderr +++ b/src/test/ui/lint/dead-code/unused-struct-variant.stderr @@ -1,11 +1,11 @@ error: variant is never constructed: `Bar` - --> $DIR/lint-dead-code-unused-variant.rs:8:5 + --> $DIR/unused-struct-variant.rs:8:5 | LL | Bar(B), | ^^^^^^ | note: lint level defined here - --> $DIR/lint-dead-code-unused-variant.rs:1:9 + --> $DIR/unused-struct-variant.rs:1:9 | LL | #![deny(unused)] | ^^^^^^ diff --git a/src/test/ui/lint/lint-dead-code-unused-variant-pub.rs b/src/test/ui/lint/dead-code/unused-variant-pub.rs similarity index 100% rename from src/test/ui/lint/lint-dead-code-unused-variant-pub.rs rename to src/test/ui/lint/dead-code/unused-variant-pub.rs diff --git a/src/test/ui/lint/lint-dead-code-variant.rs b/src/test/ui/lint/dead-code/unused-variant.rs similarity index 100% rename from src/test/ui/lint/lint-dead-code-variant.rs rename to src/test/ui/lint/dead-code/unused-variant.rs diff --git a/src/test/ui/lint/lint-dead-code-variant.stderr b/src/test/ui/lint/dead-code/unused-variant.stderr similarity index 72% rename from src/test/ui/lint/lint-dead-code-variant.stderr rename to src/test/ui/lint/dead-code/unused-variant.stderr index a79432dc68d6a..2167b9d910d94 100644 --- a/src/test/ui/lint/lint-dead-code-variant.stderr +++ b/src/test/ui/lint/dead-code/unused-variant.stderr @@ -1,11 +1,11 @@ error: variant is never constructed: `Variant1` - --> $DIR/lint-dead-code-variant.rs:5:5 + --> $DIR/unused-variant.rs:5:5 | LL | Variant1, | ^^^^^^^^ | note: lint level defined here - --> $DIR/lint-dead-code-variant.rs:1:9 + --> $DIR/unused-variant.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ diff --git a/src/test/ui/fail-no-dead-code-core.rs b/src/test/ui/lint/dead-code/with-core-crate.rs similarity index 100% rename from src/test/ui/fail-no-dead-code-core.rs rename to src/test/ui/lint/dead-code/with-core-crate.rs diff --git a/src/test/ui/fail-no-dead-code-core.stderr b/src/test/ui/lint/dead-code/with-core-crate.stderr similarity index 65% rename from src/test/ui/fail-no-dead-code-core.stderr rename to src/test/ui/lint/dead-code/with-core-crate.stderr index 2540242f9f68b..0b6ab67d9bfa5 100644 --- a/src/test/ui/fail-no-dead-code-core.stderr +++ b/src/test/ui/lint/dead-code/with-core-crate.stderr @@ -1,11 +1,11 @@ error: function is never used: `foo` - --> $DIR/fail-no-dead-code-core.rs:7:1 + --> $DIR/with-core-crate.rs:7:4 | LL | fn foo() { - | ^^^^^^^^ + | ^^^ | note: lint level defined here - --> $DIR/fail-no-dead-code-core.rs:1:9 + --> $DIR/with-core-crate.rs:1:9 | LL | #![deny(dead_code)] | ^^^^^^^^^ diff --git a/src/test/ui/dead-code-impl.rs b/src/test/ui/lint/dead-code/with-impl.rs similarity index 100% rename from src/test/ui/dead-code-impl.rs rename to src/test/ui/lint/dead-code/with-impl.rs diff --git a/src/test/ui/path-lookahead.rs b/src/test/ui/path-lookahead.rs index fd7509a623e31..86bcb08de404e 100644 --- a/src/test/ui/path-lookahead.rs +++ b/src/test/ui/path-lookahead.rs @@ -1,14 +1,14 @@ // run-pass - -#![warn(unused)] +#![allow(dead_code)] +#![warn(unused_parens)] // Parser test for #37765 -fn with_parens(arg: T) -> String { //~WARN function is never used: `with_parens` +fn with_parens(arg: T) -> String { return (::to_string(&arg)); //~WARN unnecessary parentheses around `return` value } -fn no_parens(arg: T) -> String { //~WARN function is never used: `no_parens` +fn no_parens(arg: T) -> String { return ::to_string(&arg); } diff --git a/src/test/ui/path-lookahead.stderr b/src/test/ui/path-lookahead.stderr index 197848e428a25..caf9e8303ea37 100644 --- a/src/test/ui/path-lookahead.stderr +++ b/src/test/ui/path-lookahead.stderr @@ -7,26 +7,6 @@ LL | return (::to_string(&arg)); note: lint level defined here --> $DIR/path-lookahead.rs:3:9 | -LL | #![warn(unused)] - | ^^^^^^ - = note: `#[warn(unused_parens)]` implied by `#[warn(unused)]` - -warning: function is never used: `with_parens` - --> $DIR/path-lookahead.rs:7:1 - | -LL | fn with_parens(arg: T) -> String { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/path-lookahead.rs:3:9 - | -LL | #![warn(unused)] - | ^^^^^^ - = note: `#[warn(dead_code)]` implied by `#[warn(unused)]` - -warning: function is never used: `no_parens` - --> $DIR/path-lookahead.rs:11:1 - | -LL | fn no_parens(arg: T) -> String { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | #![warn(unused_parens)] + | ^^^^^^^^^^^^^ diff --git a/src/test/ui/span/macro-span-replacement.stderr b/src/test/ui/span/macro-span-replacement.stderr index 8b65e798b6ef5..439aedb4da4d2 100644 --- a/src/test/ui/span/macro-span-replacement.stderr +++ b/src/test/ui/span/macro-span-replacement.stderr @@ -1,11 +1,8 @@ warning: struct is never constructed: `S` - --> $DIR/macro-span-replacement.rs:7:14 + --> $DIR/macro-span-replacement.rs:7:12 | LL | $b $a; - | ^ -... -LL | m!(S struct); - | ------------- in this macro invocation + | ^^ | note: lint level defined here --> $DIR/macro-span-replacement.rs:3:9 diff --git a/src/test/ui/span/unused-warning-point-at-signature.rs b/src/test/ui/span/unused-warning-point-at-identifier.rs similarity index 84% rename from src/test/ui/span/unused-warning-point-at-signature.rs rename to src/test/ui/span/unused-warning-point-at-identifier.rs index 3af272a012eb2..d4d5bc1cbc8f1 100644 --- a/src/test/ui/span/unused-warning-point-at-signature.rs +++ b/src/test/ui/span/unused-warning-point-at-identifier.rs @@ -20,8 +20,8 @@ fn func() -> usize { //~ WARN function is never used 3 } -fn //~ WARN function is never used -func_complete_span() +fn +func_complete_span() //~ WARN function is never used -> usize { 3 diff --git a/src/test/ui/span/unused-warning-point-at-signature.stderr b/src/test/ui/span/unused-warning-point-at-identifier.stderr similarity index 52% rename from src/test/ui/span/unused-warning-point-at-signature.stderr rename to src/test/ui/span/unused-warning-point-at-identifier.stderr index 83e2ec1987b47..a4715d4adeb88 100644 --- a/src/test/ui/span/unused-warning-point-at-signature.stderr +++ b/src/test/ui/span/unused-warning-point-at-identifier.stderr @@ -1,36 +1,31 @@ warning: enum is never used: `Enum` - --> $DIR/unused-warning-point-at-signature.rs:5:1 + --> $DIR/unused-warning-point-at-identifier.rs:5:6 | LL | enum Enum { - | ^^^^^^^^^ + | ^^^^ | note: lint level defined here - --> $DIR/unused-warning-point-at-signature.rs:3:9 + --> $DIR/unused-warning-point-at-identifier.rs:3:9 | LL | #![warn(unused)] | ^^^^^^ = note: `#[warn(dead_code)]` implied by `#[warn(unused)]` warning: struct is never constructed: `Struct` - --> $DIR/unused-warning-point-at-signature.rs:12:1 + --> $DIR/unused-warning-point-at-identifier.rs:12:8 | LL | struct Struct { - | ^^^^^^^^^^^^^ + | ^^^^^^ warning: function is never used: `func` - --> $DIR/unused-warning-point-at-signature.rs:19:1 + --> $DIR/unused-warning-point-at-identifier.rs:19:4 | LL | fn func() -> usize { - | ^^^^^^^^^^^^^^^^^^ + | ^^^^ warning: function is never used: `func_complete_span` - --> $DIR/unused-warning-point-at-signature.rs:23:1 + --> $DIR/unused-warning-point-at-identifier.rs:24:1 | -LL | / fn -LL | | func_complete_span() -LL | | -> usize -LL | | { -LL | | 3 -LL | | } - | |_^ +LL | func_complete_span() + | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/test-attrs/test-warns-dead-code.stderr b/src/test/ui/test-attrs/test-warns-dead-code.stderr index 62e99225dd902..cb118cdb4103c 100644 --- a/src/test/ui/test-attrs/test-warns-dead-code.stderr +++ b/src/test/ui/test-attrs/test-warns-dead-code.stderr @@ -1,8 +1,8 @@ error: function is never used: `dead` - --> $DIR/test-warns-dead-code.rs:5:1 + --> $DIR/test-warns-dead-code.rs:5:4 | LL | fn dead() {} - | ^^^^^^^^^ + | ^^^^ | note: lint level defined here --> $DIR/test-warns-dead-code.rs:3:9 diff --git a/src/test/ui/thread-local-not-in-prelude.rs b/src/test/ui/thread-local-not-in-prelude.rs index 039749826256f..e5ed09c600bf9 100644 --- a/src/test/ui/thread-local-not-in-prelude.rs +++ b/src/test/ui/thread-local-not-in-prelude.rs @@ -1,5 +1,4 @@ // run-pass - #![no_std] extern crate std; diff --git a/src/test/ui/dead-code-ret.rs b/src/test/ui/unreachable-code-ret.rs similarity index 100% rename from src/test/ui/dead-code-ret.rs rename to src/test/ui/unreachable-code-ret.rs diff --git a/src/test/ui/dead-code-ret.stderr b/src/test/ui/unreachable-code-ret.stderr similarity index 86% rename from src/test/ui/dead-code-ret.stderr rename to src/test/ui/unreachable-code-ret.stderr index 83841131599b2..c22342ce7218d 100644 --- a/src/test/ui/dead-code-ret.stderr +++ b/src/test/ui/unreachable-code-ret.stderr @@ -1,5 +1,5 @@ error: unreachable statement - --> $DIR/dead-code-ret.rs:7:5 + --> $DIR/unreachable-code-ret.rs:7:5 | LL | return; | ------ any code following this expression is unreachable @@ -7,7 +7,7 @@ LL | println!("Paul is dead"); | ^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable statement | note: lint level defined here - --> $DIR/dead-code-ret.rs:3:9 + --> $DIR/unreachable-code-ret.rs:3:9 | LL | #![deny(unreachable_code)] | ^^^^^^^^^^^^^^^^