Skip to content

Commit

Permalink
unused_imports: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pietroalbini committed Feb 8, 2019
1 parent 5681b91 commit 5ef7150
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/test/ui/bad/bad-lint-cap2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error: unused import: `std::option`
--> $DIR/bad-lint-cap2.rs:6:5
|
LL | use std::option; //~ ERROR
| ^^^^^^^^^^^
| ----^^^^^^^^^^^- help: remove the whole `use` item
|
note: lint level defined here
--> $DIR/bad-lint-cap2.rs:4:9
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/bad/bad-lint-cap3.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ warning: unused import: `std::option`
--> $DIR/bad-lint-cap3.rs:7:5
|
LL | use std::option; //~ WARN
| ^^^^^^^^^^^
| ----^^^^^^^^^^^- help: remove the whole `use` item
|
note: lint level defined here
--> $DIR/bad-lint-cap3.rs:4:9
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/imports/unused.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error: unused import: `super::f`
--> $DIR/unused.rs:7:24
|
LL | pub(super) use super::f; //~ ERROR unused
| ^^^^^^^^
| ---------------^^^^^^^^- help: remove the whole `use` item
|
note: lint level defined here
--> $DIR/unused.rs:1:9
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-30730.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error: unused import: `std::thread`
--> $DIR/issue-30730.rs:3:5
|
LL | use std::thread;
| ^^^^^^^^^^^
| ----^^^^^^^^^^^- help: remove the whole `use` item
|
note: lint level defined here
--> $DIR/issue-30730.rs:2:9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error: unused import: `a::x`
--> $DIR/lint-directives-on-use-items-issue-10534.rs:12:9
|
LL | use a::x; //~ ERROR: unused import
| ^^^^
| ----^^^^- help: remove the whole `use` item
|
note: lint level defined here
--> $DIR/lint-directives-on-use-items-issue-10534.rs:1:9
Expand All @@ -14,7 +14,7 @@ error: unused import: `a::y`
--> $DIR/lint-directives-on-use-items-issue-10534.rs:21:9
|
LL | use a::y; //~ ERROR: unused import
| ^^^^
| ----^^^^- help: remove the whole `use` item
|
note: lint level defined here
--> $DIR/lint-directives-on-use-items-issue-10534.rs:20:12
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/lint/lint-unused-imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use bar::c::cc as cal;
use std::mem::*; // shouldn't get errors for not using
// everything imported
use std::fmt::{};
//~^ ERROR unused import: `use std::fmt::{};`
//~^ ERROR unused import: `std::fmt::{}`

// Should get errors for both 'Some' and 'None'
use std::option::Option::{Some, None};
Expand Down
20 changes: 11 additions & 9 deletions src/test/ui/lint/lint-unused-imports.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: unused import: `use std::fmt::{};`
--> $DIR/lint-unused-imports.rs:8:1
error: unused import: `std::fmt::{}`
--> $DIR/lint-unused-imports.rs:8:5
|
LL | use std::fmt::{};
| ^^^^^^^^^^^^^^^^^
| ----^^^^^^^^^^^^- help: remove the whole `use` item
|
note: lint level defined here
--> $DIR/lint-unused-imports.rs:1:9
Expand All @@ -14,37 +14,39 @@ error: unused imports: `None`, `Some`
--> $DIR/lint-unused-imports.rs:12:27
|
LL | use std::option::Option::{Some, None};
| ^^^^ ^^^^
| --------------------------^^^^--^^^^-- help: remove the whole `use` item

error: unused import: `test::A`
--> $DIR/lint-unused-imports.rs:15:5
|
LL | use test::A; //~ ERROR unused import: `test::A`
| ^^^^^^^
| ----^^^^^^^- help: remove the whole `use` item

error: unused import: `bar`
--> $DIR/lint-unused-imports.rs:24:18
|
LL | use test2::{foo, bar}; //~ ERROR unused import: `bar`
| ^^^
| --^^^
| |
| help: remove the unused import

error: unused import: `foo::Square`
--> $DIR/lint-unused-imports.rs:52:13
|
LL | use foo::Square; //~ ERROR unused import: `foo::Square`
| ^^^^^^^^^^^
| ----^^^^^^^^^^^- help: remove the whole `use` item

error: unused import: `self::g`
--> $DIR/lint-unused-imports.rs:68:9
|
LL | use self::g; //~ ERROR unused import: `self::g`
| ^^^^^^^
| ----^^^^^^^- help: remove the whole `use` item

error: unused import: `test2::foo`
--> $DIR/lint-unused-imports.rs:77:9
|
LL | use test2::foo; //~ ERROR unused import: `test2::foo`
| ^^^^^^^^^^
| ----^^^^^^^^^^- help: remove the whole `use` item

error: unused import: `test::B2`
--> $DIR/lint-unused-imports.rs:20:5
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/lint/lints-in-foreign-macros.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ warning: unused import: `std::string::ToString`
--> $DIR/lints-in-foreign-macros.rs:11:16
|
LL | () => {use std::string::ToString;} //~ WARN: unused import
| ^^^^^^^^^^^^^^^^^^^^^
| ----^^^^^^^^^^^^^^^^^^^^^- help: remove the whole `use` item
...
LL | mod a { foo!(); }
| ------- in this macro invocation
Expand All @@ -17,13 +17,13 @@ warning: unused import: `std::string::ToString`
--> $DIR/lints-in-foreign-macros.rs:16:18
|
LL | mod c { baz!(use std::string::ToString;); } //~ WARN: unused import
| ^^^^^^^^^^^^^^^^^^^^^
| ----^^^^^^^^^^^^^^^^^^^^^- help: remove the whole `use` item

warning: unused import: `std::string::ToString`
--> $DIR/lints-in-foreign-macros.rs:17:19
|
LL | mod d { baz2!(use std::string::ToString;); } //~ WARN: unused import
| ^^^^^^^^^^^^^^^^^^^^^
| ----^^^^^^^^^^^^^^^^^^^^^- help: remove the whole `use` item

warning: missing documentation for crate
--> $DIR/lints-in-foreign-macros.rs:4:1
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/rfc-2166-underscore-imports/basic.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ warning: unused import: `m::Tr1 as _`
--> $DIR/basic.rs:26:9
|
LL | use m::Tr1 as _; //~ WARN unused import
| ^^^^^^^^^^^
| ----^^^^^^^^^^^- help: remove the whole `use` item
|
note: lint level defined here
--> $DIR/basic.rs:4:9
Expand All @@ -14,5 +14,5 @@ warning: unused import: `S as _`
--> $DIR/basic.rs:27:9
|
LL | use S as _; //~ WARN unused import
| ^^^^^^
| ----^^^^^^- help: remove the whole `use` item

4 changes: 2 additions & 2 deletions src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error: unused import: `core::any`
--> $DIR/unused-2018.rs:6:9
|
LL | use core::any; //~ ERROR unused import: `core::any`
| ^^^^^^^^^
| ----^^^^^^^^^- help: remove the whole `use` item
|
note: lint level defined here
--> $DIR/unused-2018.rs:3:9
Expand All @@ -14,7 +14,7 @@ error: unused import: `core`
--> $DIR/unused-2018.rs:10:9
|
LL | use core; //~ ERROR unused import: `core`
| ^^^^
| ----^^^^- help: remove the whole `use` item

error: aborting due to 2 previous errors

4 changes: 4 additions & 0 deletions src/test/ui/span/multispan-import-lint.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ note: lint level defined here
LL | #![warn(unused)]
| ^^^^^^
= note: #[warn(unused_imports)] implied by #[warn(unused)]
help: remove the unused imports
|
LL | use std::cmp::{min};
| -- --

2 changes: 1 addition & 1 deletion src/test/ui/use/use-nested-groups-unused-imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use foo::{Foo, bar::{baz::{}, foobar::*}, *};
use foo::bar::baz::{*, *};
//~^ ERROR unused import: `*`
use foo::{};
//~^ ERROR unused import: `use foo::{};`
//~^ ERROR unused import: `foo::{}`

fn main() {
let _: Bar;
Expand Down
12 changes: 7 additions & 5 deletions src/test/ui/use/use-nested-groups-unused-imports.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ error: unused imports: `*`, `Foo`, `baz::{}`, `foobar::*`
--> $DIR/use-nested-groups-unused-imports.rs:16:11
|
LL | use foo::{Foo, bar::{baz::{}, foobar::*}, *};
| ^^^ ^^^^^^^ ^^^^^^^^^ ^
| ----------^^^--------^^^^^^^--^^^^^^^^^---^-- help: remove the whole `use` item
|
note: lint level defined here
--> $DIR/use-nested-groups-unused-imports.rs:3:9
Expand All @@ -14,13 +14,15 @@ error: unused import: `*`
--> $DIR/use-nested-groups-unused-imports.rs:18:24
|
LL | use foo::bar::baz::{*, *};
| ^
| --^
| |
| help: remove the unused import

error: unused import: `use foo::{};`
--> $DIR/use-nested-groups-unused-imports.rs:20:1
error: unused import: `foo::{}`
--> $DIR/use-nested-groups-unused-imports.rs:20:5
|
LL | use foo::{};
| ^^^^^^^^^^^^
| ----^^^^^^^- help: remove the whole `use` item

error: aborting due to 3 previous errors

0 comments on commit 5ef7150

Please sign in to comment.