diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2019-03-10 20:05:01 -0700 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2019-03-23 13:05:30 -0700 |
| commit | 3211f38828cc45d25b31cbf49dfbd0913bac29d6 (patch) | |
| tree | 0807dba4bb21f2a3d5514b234e8661bdbb45ddcd | |
| parent | 9bfb0ef818456cce57edcb2463f63f71594e4a13 (diff) | |
| download | rust-3211f38828cc45d25b31cbf49dfbd0913bac29d6.tar.gz rust-3211f38828cc45d25b31cbf49dfbd0913bac29d6.zip | |
Tweak unnecessary import suggestion
| -rw-r--r-- | src/librustc_resolve/lib.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/double-type-import.stderr | 6 | ||||
| -rw-r--r-- | src/test/ui/imports/duplicate.stderr | 6 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-26886.stderr | 12 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-52891.stderr | 12 | ||||
| -rw-r--r-- | src/test/ui/proc-macro/shadow.stderr | 14 | ||||
| -rw-r--r-- | src/test/ui/resolve/resolve-conflict-import-vs-import.stderr | 6 | ||||
| -rw-r--r-- | src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr | 6 | ||||
| -rw-r--r-- | src/test/ui/use/use-paths-as-items.stderr | 6 |
9 files changed, 25 insertions, 45 deletions
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index ac149be4b2a..973c58a67a5 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -4932,7 +4932,7 @@ impl<'a> Resolver<'a> { Some((directive, _, true)) if should_remove_import && !directive.is_glob() => { // Simple case - remove the entire import. Due to the above match arm, this can // only be a single use so just remove it entirely. - err.span_suggestion( + err.span_suggestion_hidden( directive.use_span_with_attributes, "remove unnecessary import", String::new(), diff --git a/src/test/ui/double-type-import.stderr b/src/test/ui/double-type-import.stderr index c7288af13c2..d5e153d22ad 100644 --- a/src/test/ui/double-type-import.stderr +++ b/src/test/ui/double-type-import.stderr @@ -4,12 +4,10 @@ error[E0252]: the name `X` is defined multiple times LL | pub use self::bar::X; | ------------ previous import of the type `X` here LL | use self::bar::X; - | ----^^^^^^^^^^^^- - | | | - | | `X` reimported here - | help: remove unnecessary import + | ^^^^^^^^^^^^ `X` reimported here | = note: `X` must be defined only once in the type namespace of this module + = help: remove unnecessary import error: aborting due to previous error diff --git a/src/test/ui/imports/duplicate.stderr b/src/test/ui/imports/duplicate.stderr index 7c43c642ec3..f85a265487b 100644 --- a/src/test/ui/imports/duplicate.stderr +++ b/src/test/ui/imports/duplicate.stderr @@ -4,12 +4,10 @@ error[E0252]: the name `foo` is defined multiple times LL | use a::foo; | ------ previous import of the value `foo` here LL | use a::foo; - | ----^^^^^^- - | | | - | | `foo` reimported here - | help: remove unnecessary import + | ^^^^^^ `foo` reimported here | = note: `foo` must be defined only once in the value namespace of this module + = help: remove unnecessary import error[E0659]: `foo` is ambiguous (glob import vs glob import in the same module) --> $DIR/duplicate.rs:46:15 diff --git a/src/test/ui/issues/issue-26886.stderr b/src/test/ui/issues/issue-26886.stderr index fa7f922707a..6002befe0d8 100644 --- a/src/test/ui/issues/issue-26886.stderr +++ b/src/test/ui/issues/issue-26886.stderr @@ -4,12 +4,10 @@ error[E0252]: the name `Arc` is defined multiple times LL | use std::sync::{self, Arc}; | --- previous import of the type `Arc` here LL | use std::sync::Arc; - | ----^^^^^^^^^^^^^^- - | | | - | | `Arc` reimported here - | help: remove unnecessary import + | ^^^^^^^^^^^^^^ `Arc` reimported here | = note: `Arc` must be defined only once in the type namespace of this module + = help: remove unnecessary import error[E0252]: the name `sync` is defined multiple times --> $DIR/issue-26886.rs:4:5 @@ -18,12 +16,10 @@ LL | use std::sync::{self, Arc}; | ---- previous import of the module `sync` here ... LL | use std::sync; - | ----^^^^^^^^^- - | | | - | | `sync` reimported here - | help: remove unnecessary import + | ^^^^^^^^^ `sync` reimported here | = note: `sync` must be defined only once in the type namespace of this module + = help: remove unnecessary import error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-52891.stderr b/src/test/ui/issues/issue-52891.stderr index 1385693e91a..6068c975057 100644 --- a/src/test/ui/issues/issue-52891.stderr +++ b/src/test/ui/issues/issue-52891.stderr @@ -4,12 +4,10 @@ error[E0252]: the name `a` is defined multiple times LL | use issue_52891::a; | -------------- previous import of the module `a` here LL | use issue_52891::a; - | ----^^^^^^^^^^^^^^- - | | | - | | `a` reimported here - | help: remove unnecessary import + | ^^^^^^^^^^^^^^ `a` reimported here | = note: `a` must be defined only once in the type namespace of this module + = help: remove unnecessary import error[E0252]: the name `a` is defined multiple times --> $DIR/issue-52891.rs:14:19 @@ -129,15 +127,13 @@ error[E0252]: the name `n` is defined multiple times --> $DIR/issue-52891.rs:36:5 | LL | use issue_52891::n; - | ------------------- - | | | - | | previous import of the module `n` here - | help: remove unnecessary import + | -------------- previous import of the module `n` here LL | #[macro_use] LL | use issue_52891::n; | ^^^^^^^^^^^^^^ `n` reimported here | = note: `n` must be defined only once in the type namespace of this module + = help: remove unnecessary import error: aborting due to 10 previous errors diff --git a/src/test/ui/proc-macro/shadow.stderr b/src/test/ui/proc-macro/shadow.stderr index 91b73903aca..597c05434f3 100644 --- a/src/test/ui/proc-macro/shadow.stderr +++ b/src/test/ui/proc-macro/shadow.stderr @@ -1,16 +1,14 @@ error[E0259]: the name `derive_a` is defined multiple times --> $DIR/shadow.rs:6:1 | -LL | extern crate derive_a; - | ---------------------- previous import of the extern crate `derive_a` here -LL | / #[macro_use] -LL | | extern crate derive_a; - | | ^^^^^^^^^^^^^^^^^^^^^- - | |_|____________________| - | | help: remove unnecessary import - | `derive_a` reimported here +LL | extern crate derive_a; + | ---------------------- previous import of the extern crate `derive_a` here +LL | #[macro_use] +LL | extern crate derive_a; + | ^^^^^^^^^^^^^^^^^^^^^^ `derive_a` reimported here | = note: `derive_a` must be defined only once in the type namespace of this module + = help: remove unnecessary import error: aborting due to previous error diff --git a/src/test/ui/resolve/resolve-conflict-import-vs-import.stderr b/src/test/ui/resolve/resolve-conflict-import-vs-import.stderr index 1b4b058b783..34f18feb9dc 100644 --- a/src/test/ui/resolve/resolve-conflict-import-vs-import.stderr +++ b/src/test/ui/resolve/resolve-conflict-import-vs-import.stderr @@ -4,12 +4,10 @@ error[E0252]: the name `transmute` is defined multiple times LL | use std::mem::transmute; | ------------------- previous import of the value `transmute` here LL | use std::mem::transmute; - | ----^^^^^^^^^^^^^^^^^^^- - | | | - | | `transmute` reimported here - | help: remove unnecessary import + | ^^^^^^^^^^^^^^^^^^^ `transmute` reimported here | = note: `transmute` must be defined only once in the value namespace of this module + = help: remove unnecessary import error: aborting due to previous error diff --git a/src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr b/src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr index e8679a3726d..cfae699b6ed 100644 --- a/src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr +++ b/src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr @@ -4,12 +4,10 @@ error[E0254]: the name `core` is defined multiple times LL | extern crate core; | ------------------ previous import of the extern crate `core` here LL | use core; - | ----^^^^- - | | | - | | `core` reimported here - | help: remove unnecessary import + | ^^^^ `core` reimported here | = note: `core` must be defined only once in the type namespace of this module + = help: remove unnecessary import error: aborting due to previous error diff --git a/src/test/ui/use/use-paths-as-items.stderr b/src/test/ui/use/use-paths-as-items.stderr index 334e145098b..43ebbf157c3 100644 --- a/src/test/ui/use/use-paths-as-items.stderr +++ b/src/test/ui/use/use-paths-as-items.stderr @@ -4,12 +4,10 @@ error[E0252]: the name `mem` is defined multiple times LL | use std::{mem, ptr}; | --- previous import of the module `mem` here LL | use std::mem; - | ----^^^^^^^^- - | | | - | | `mem` reimported here - | help: remove unnecessary import + | ^^^^^^^^ `mem` reimported here | = note: `mem` must be defined only once in the type namespace of this module + = help: remove unnecessary import error: aborting due to previous error |
