-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Silence unused_imports lint for redundant imports
- Loading branch information
1 parent
72fe8a0
commit 0db2a40
Showing
26 changed files
with
43 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
//@ check-pass | ||
// Check that we detect imports that are redundant due to the extern prelude | ||
// and that we emit a reasonable diagnostic. | ||
// issue: rust-lang/rust#121915 | ||
//~^^^ NOTE the item `aux_issue_121915` is already defined by the extern prelude | ||
|
||
// See also the discussion in <https://github.com/rust-lang/rust/pull/122954>. | ||
|
||
//@ compile-flags: --extern aux_issue_121915 --edition 2018 | ||
//@ aux-build: aux-issue-121915.rs | ||
|
||
#[deny(unused_imports)] | ||
//~^ NOTE the lint level is defined here | ||
fn main() { | ||
use aux_issue_121915; | ||
//~^ ERROR the item `aux_issue_121915` is imported redundantly | ||
//FIXME(unused_imports): ~^ ERROR the item `aux_issue_121915` is imported redundantly | ||
aux_issue_121915::item(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
tests/ui/imports/redundant-import-issue-121915-2015.stderr
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
tests/ui/imports/redundant-import-lang-prelude-attr.stderr
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,20 @@ | ||
error: the item `TryFrom` is imported redundantly | ||
--> $DIR/suggest-remove-issue-121315.rs:7:9 | ||
| | ||
LL | use std::convert::TryFrom; | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
--> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | ||
| | ||
= note: the item `TryFrom` is already defined here | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/suggest-remove-issue-121315.rs:2:9 | ||
| | ||
LL | #![deny(unused_imports)] | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: the item `TryFrom` is imported redundantly | ||
--> $DIR/suggest-remove-issue-121315.rs:14:24 | ||
| | ||
LL | use std::convert::{TryFrom, TryInto}; | ||
| ^^^^^^^ | ||
--> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | ||
| | ||
= note: the item `TryFrom` is already defined here | ||
|
||
error: the item `TryInto` is imported redundantly | ||
--> $DIR/suggest-remove-issue-121315.rs:14:33 | ||
| | ||
LL | use std::convert::{TryFrom, TryInto}; | ||
| ^^^^^^^ | ||
--> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | ||
| | ||
= note: the item `TryInto` is already defined here | ||
|
||
error: unused import: `AsMut` | ||
--> $DIR/suggest-remove-issue-121315.rs:24:24 | ||
--> $DIR/suggest-remove-issue-121315.rs:25:24 | ||
| | ||
LL | use std::convert::{AsMut, Into}; | ||
| ^^^^^ | ||
|
||
error: the item `Into` is imported redundantly | ||
--> $DIR/suggest-remove-issue-121315.rs:24:31 | ||
| | ||
LL | use std::convert::{AsMut, Into}; | ||
| ^^^^ | ||
--> $SRC_DIR/std/src/prelude/mod.rs:LL:COL | ||
note: the lint level is defined here | ||
--> $DIR/suggest-remove-issue-121315.rs:3:9 | ||
| | ||
= note: the item `Into` is already defined here | ||
LL | #![deny(unused_imports)] | ||
| ^^^^^^^^^^^^^^ | ||
|
||
error: unused import: `From` | ||
--> $DIR/suggest-remove-issue-121315.rs:33:24 | ||
--> $DIR/suggest-remove-issue-121315.rs:34:24 | ||
| | ||
LL | use std::convert::{From, Infallible}; | ||
| ^^^^ | ||
|
||
error: aborting due to 6 previous errors | ||
error: aborting due to 2 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
//@ check-pass | ||
#![deny(unused_imports)] | ||
|
||
struct S; | ||
|
||
fn main() { | ||
use S; //~ ERROR the item `S` is imported redundantly | ||
use S; //FIXME(unused_imports): ~ ERROR the item `S` is imported redundantly | ||
|
||
let _s = S; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
tests/ui/lint/use-redundant/use-redundant-glob-parent.stderr
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
tests/ui/lint/use-redundant/use-redundant-issue-71450.stderr
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.