Skip to content

Commit 5ef7150

Browse files
committed
unused_imports: update tests
1 parent 5681b91 commit 5ef7150

13 files changed

+37
-29
lines changed

src/test/ui/bad/bad-lint-cap2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: unused import: `std::option`
22
--> $DIR/bad-lint-cap2.rs:6:5
33
|
44
LL | use std::option; //~ ERROR
5-
| ^^^^^^^^^^^
5+
| ----^^^^^^^^^^^- help: remove the whole `use` item
66
|
77
note: lint level defined here
88
--> $DIR/bad-lint-cap2.rs:4:9

src/test/ui/bad/bad-lint-cap3.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ warning: unused import: `std::option`
22
--> $DIR/bad-lint-cap3.rs:7:5
33
|
44
LL | use std::option; //~ WARN
5-
| ^^^^^^^^^^^
5+
| ----^^^^^^^^^^^- help: remove the whole `use` item
66
|
77
note: lint level defined here
88
--> $DIR/bad-lint-cap3.rs:4:9

src/test/ui/imports/unused.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: unused import: `super::f`
22
--> $DIR/unused.rs:7:24
33
|
44
LL | pub(super) use super::f; //~ ERROR unused
5-
| ^^^^^^^^
5+
| ---------------^^^^^^^^- help: remove the whole `use` item
66
|
77
note: lint level defined here
88
--> $DIR/unused.rs:1:9

src/test/ui/issues/issue-30730.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: unused import: `std::thread`
22
--> $DIR/issue-30730.rs:3:5
33
|
44
LL | use std::thread;
5-
| ^^^^^^^^^^^
5+
| ----^^^^^^^^^^^- help: remove the whole `use` item
66
|
77
note: lint level defined here
88
--> $DIR/issue-30730.rs:2:9

src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: unused import: `a::x`
22
--> $DIR/lint-directives-on-use-items-issue-10534.rs:12:9
33
|
44
LL | use a::x; //~ ERROR: unused import
5-
| ^^^^
5+
| ----^^^^- help: remove the whole `use` item
66
|
77
note: lint level defined here
88
--> $DIR/lint-directives-on-use-items-issue-10534.rs:1:9
@@ -14,7 +14,7 @@ error: unused import: `a::y`
1414
--> $DIR/lint-directives-on-use-items-issue-10534.rs:21:9
1515
|
1616
LL | use a::y; //~ ERROR: unused import
17-
| ^^^^
17+
| ----^^^^- help: remove the whole `use` item
1818
|
1919
note: lint level defined here
2020
--> $DIR/lint-directives-on-use-items-issue-10534.rs:20:12

src/test/ui/lint/lint-unused-imports.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use bar::c::cc as cal;
66
use std::mem::*; // shouldn't get errors for not using
77
// everything imported
88
use std::fmt::{};
9-
//~^ ERROR unused import: `use std::fmt::{};`
9+
//~^ ERROR unused import: `std::fmt::{}`
1010

1111
// Should get errors for both 'Some' and 'None'
1212
use std::option::Option::{Some, None};

src/test/ui/lint/lint-unused-imports.stderr

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: unused import: `use std::fmt::{};`
2-
--> $DIR/lint-unused-imports.rs:8:1
1+
error: unused import: `std::fmt::{}`
2+
--> $DIR/lint-unused-imports.rs:8:5
33
|
44
LL | use std::fmt::{};
5-
| ^^^^^^^^^^^^^^^^^
5+
| ----^^^^^^^^^^^^- help: remove the whole `use` item
66
|
77
note: lint level defined here
88
--> $DIR/lint-unused-imports.rs:1:9
@@ -14,37 +14,39 @@ error: unused imports: `None`, `Some`
1414
--> $DIR/lint-unused-imports.rs:12:27
1515
|
1616
LL | use std::option::Option::{Some, None};
17-
| ^^^^ ^^^^
17+
| --------------------------^^^^--^^^^-- help: remove the whole `use` item
1818

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

2525
error: unused import: `bar`
2626
--> $DIR/lint-unused-imports.rs:24:18
2727
|
2828
LL | use test2::{foo, bar}; //~ ERROR unused import: `bar`
29-
| ^^^
29+
| --^^^
30+
| |
31+
| help: remove the unused import
3032

3133
error: unused import: `foo::Square`
3234
--> $DIR/lint-unused-imports.rs:52:13
3335
|
3436
LL | use foo::Square; //~ ERROR unused import: `foo::Square`
35-
| ^^^^^^^^^^^
37+
| ----^^^^^^^^^^^- help: remove the whole `use` item
3638

3739
error: unused import: `self::g`
3840
--> $DIR/lint-unused-imports.rs:68:9
3941
|
4042
LL | use self::g; //~ ERROR unused import: `self::g`
41-
| ^^^^^^^
43+
| ----^^^^^^^- help: remove the whole `use` item
4244

4345
error: unused import: `test2::foo`
4446
--> $DIR/lint-unused-imports.rs:77:9
4547
|
4648
LL | use test2::foo; //~ ERROR unused import: `test2::foo`
47-
| ^^^^^^^^^^
49+
| ----^^^^^^^^^^- help: remove the whole `use` item
4850

4951
error: unused import: `test::B2`
5052
--> $DIR/lint-unused-imports.rs:20:5

src/test/ui/lint/lints-in-foreign-macros.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ warning: unused import: `std::string::ToString`
22
--> $DIR/lints-in-foreign-macros.rs:11:16
33
|
44
LL | () => {use std::string::ToString;} //~ WARN: unused import
5-
| ^^^^^^^^^^^^^^^^^^^^^
5+
| ----^^^^^^^^^^^^^^^^^^^^^- help: remove the whole `use` item
66
...
77
LL | mod a { foo!(); }
88
| ------- in this macro invocation
@@ -17,13 +17,13 @@ warning: unused import: `std::string::ToString`
1717
--> $DIR/lints-in-foreign-macros.rs:16:18
1818
|
1919
LL | mod c { baz!(use std::string::ToString;); } //~ WARN: unused import
20-
| ^^^^^^^^^^^^^^^^^^^^^
20+
| ----^^^^^^^^^^^^^^^^^^^^^- help: remove the whole `use` item
2121

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

2828
warning: missing documentation for crate
2929
--> $DIR/lints-in-foreign-macros.rs:4:1

src/test/ui/rfc-2166-underscore-imports/basic.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ warning: unused import: `m::Tr1 as _`
22
--> $DIR/basic.rs:26:9
33
|
44
LL | use m::Tr1 as _; //~ WARN unused import
5-
| ^^^^^^^^^^^
5+
| ----^^^^^^^^^^^- help: remove the whole `use` item
66
|
77
note: lint level defined here
88
--> $DIR/basic.rs:4:9
@@ -14,5 +14,5 @@ warning: unused import: `S as _`
1414
--> $DIR/basic.rs:27:9
1515
|
1616
LL | use S as _; //~ WARN unused import
17-
| ^^^^^^
17+
| ----^^^^^^- help: remove the whole `use` item
1818

src/test/ui/rfc-2166-underscore-imports/unused-2018.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: unused import: `core::any`
22
--> $DIR/unused-2018.rs:6:9
33
|
44
LL | use core::any; //~ ERROR unused import: `core::any`
5-
| ^^^^^^^^^
5+
| ----^^^^^^^^^- help: remove the whole `use` item
66
|
77
note: lint level defined here
88
--> $DIR/unused-2018.rs:3:9
@@ -14,7 +14,7 @@ error: unused import: `core`
1414
--> $DIR/unused-2018.rs:10:9
1515
|
1616
LL | use core; //~ ERROR unused import: `core`
17-
| ^^^^
17+
| ----^^^^- help: remove the whole `use` item
1818

1919
error: aborting due to 2 previous errors
2020

src/test/ui/span/multispan-import-lint.stderr

+4
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ note: lint level defined here
1010
LL | #![warn(unused)]
1111
| ^^^^^^
1212
= note: #[warn(unused_imports)] implied by #[warn(unused)]
13+
help: remove the unused imports
14+
|
15+
LL | use std::cmp::{min};
16+
| -- --
1317

src/test/ui/use/use-nested-groups-unused-imports.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use foo::{Foo, bar::{baz::{}, foobar::*}, *};
1818
use foo::bar::baz::{*, *};
1919
//~^ ERROR unused import: `*`
2020
use foo::{};
21-
//~^ ERROR unused import: `use foo::{};`
21+
//~^ ERROR unused import: `foo::{}`
2222

2323
fn main() {
2424
let _: Bar;

src/test/ui/use/use-nested-groups-unused-imports.stderr

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: unused imports: `*`, `Foo`, `baz::{}`, `foobar::*`
22
--> $DIR/use-nested-groups-unused-imports.rs:16:11
33
|
44
LL | use foo::{Foo, bar::{baz::{}, foobar::*}, *};
5-
| ^^^ ^^^^^^^ ^^^^^^^^^ ^
5+
| ----------^^^--------^^^^^^^--^^^^^^^^^---^-- help: remove the whole `use` item
66
|
77
note: lint level defined here
88
--> $DIR/use-nested-groups-unused-imports.rs:3:9
@@ -14,13 +14,15 @@ error: unused import: `*`
1414
--> $DIR/use-nested-groups-unused-imports.rs:18:24
1515
|
1616
LL | use foo::bar::baz::{*, *};
17-
| ^
17+
| --^
18+
| |
19+
| help: remove the unused import
1820

19-
error: unused import: `use foo::{};`
20-
--> $DIR/use-nested-groups-unused-imports.rs:20:1
21+
error: unused import: `foo::{}`
22+
--> $DIR/use-nested-groups-unused-imports.rs:20:5
2123
|
2224
LL | use foo::{};
23-
| ^^^^^^^^^^^^
25+
| ----^^^^^^^- help: remove the whole `use` item
2426

2527
error: aborting due to 3 previous errors
2628

0 commit comments

Comments
 (0)