Skip to content

Commit

Permalink
Rollup merge of rust-lang#72947 - ayushmishra2005:remove_noisy_sugges…
Browse files Browse the repository at this point in the history
…tion, r=davidtwco

Remove noisy suggestion

Remove noisy suggestion rust-lang#72642
  • Loading branch information
Dylan-DPC authored Jun 4, 2020
2 parents aad25fe + 968594d commit 84e1c78
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 58 deletions.
4 changes: 3 additions & 1 deletion src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,9 @@ impl<'a> Resolver<'a> {
Res::Def(DefKind::Ctor(..), did) => this.parent(did),
_ => res.opt_def_id(),
};
candidates.push(ImportSuggestion { did, descr: res.descr(), path });
if candidates.iter().all(|v: &ImportSuggestion| v.did != did) {
candidates.push(ImportSuggestion { did, descr: res.descr(), path });
}
}
}
}
Expand Down
10 changes: 4 additions & 6 deletions src/test/ui/issues/issue-17546.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ LL | use std::fmt::Result;
|
LL | use std::io::Result;
|
LL | use std::prelude::v1::Result;
|
LL | use std::result::Result;
|
and 1 other candidate
LL | use std::thread::Result;
|

error[E0573]: expected type, found variant `Result`
--> $DIR/issue-17546.rs:30:13
Expand All @@ -48,11 +47,10 @@ LL | use std::fmt::Result;
|
LL | use std::io::Result;
|
LL | use std::prelude::v1::Result;
|
LL | use std::result::Result;
|
and 1 other candidate
LL | use std::thread::Result;
|

error[E0573]: expected type, found variant `NoResult`
--> $DIR/issue-17546.rs:35:15
Expand Down
48 changes: 12 additions & 36 deletions src/test/ui/no-implicit-prelude-nested.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,29 @@ error[E0404]: expected trait, found derive macro `Clone`
LL | impl Clone for Test {}
| ^^^^^ not a trait
|
help: consider importing one of these items instead
help: consider importing this trait instead
|
LL | use std::clone::Clone;
|
LL | use std::prelude::v1::Clone;
|

error[E0405]: cannot find trait `Iterator` in this scope
--> $DIR/no-implicit-prelude-nested.rs:13:14
|
LL | impl Iterator for Test {}
| ^^^^^^^^ not found in this scope
|
help: consider importing one of these items
help: consider importing this trait
|
LL | use std::iter::Iterator;
|
LL | use std::prelude::v1::Iterator;
|

error[E0405]: cannot find trait `ToString` in this scope
--> $DIR/no-implicit-prelude-nested.rs:14:14
|
LL | impl ToString for Test {}
| ^^^^^^^^ not found in this scope
|
help: consider importing one of these items
|
LL | use std::prelude::v1::ToString;
help: consider importing this trait
|
LL | use std::string::ToString;
|
Expand All @@ -60,12 +54,10 @@ error[E0425]: cannot find function `drop` in this scope
LL | drop(2)
| ^^^^ not found in this scope
|
help: consider importing one of these items
help: consider importing this function
|
LL | use std::mem::drop;
|
LL | use std::prelude::v1::drop;
|

error[E0405]: cannot find trait `Add` in this scope
--> $DIR/no-implicit-prelude-nested.rs:23:10
Expand All @@ -84,35 +76,29 @@ error[E0404]: expected trait, found derive macro `Clone`
LL | impl Clone for Test {}
| ^^^^^ not a trait
|
help: consider importing one of these items instead
help: consider importing this trait instead
|
LL | use std::clone::Clone;
|
LL | use std::prelude::v1::Clone;
|

error[E0405]: cannot find trait `Iterator` in this scope
--> $DIR/no-implicit-prelude-nested.rs:25:10
|
LL | impl Iterator for Test {}
| ^^^^^^^^ not found in this scope
|
help: consider importing one of these items
help: consider importing this trait
|
LL | use std::iter::Iterator;
|
LL | use std::prelude::v1::Iterator;
|

error[E0405]: cannot find trait `ToString` in this scope
--> $DIR/no-implicit-prelude-nested.rs:26:10
|
LL | impl ToString for Test {}
| ^^^^^^^^ not found in this scope
|
help: consider importing one of these items
|
LL | use std::prelude::v1::ToString;
help: consider importing this trait
|
LL | use std::string::ToString;
|
Expand All @@ -129,12 +115,10 @@ error[E0425]: cannot find function `drop` in this scope
LL | drop(2)
| ^^^^ not found in this scope
|
help: consider importing one of these items
help: consider importing this function
|
LL | use std::mem::drop;
|
LL | use std::prelude::v1::drop;
|

error[E0405]: cannot find trait `Add` in this scope
--> $DIR/no-implicit-prelude-nested.rs:38:14
Expand All @@ -153,35 +137,29 @@ error[E0404]: expected trait, found derive macro `Clone`
LL | impl Clone for Test {}
| ^^^^^ not a trait
|
help: consider importing one of these items instead
help: consider importing this trait instead
|
LL | use std::clone::Clone;
|
LL | use std::prelude::v1::Clone;
|

error[E0405]: cannot find trait `Iterator` in this scope
--> $DIR/no-implicit-prelude-nested.rs:40:14
|
LL | impl Iterator for Test {}
| ^^^^^^^^ not found in this scope
|
help: consider importing one of these items
help: consider importing this trait
|
LL | use std::iter::Iterator;
|
LL | use std::prelude::v1::Iterator;
|

error[E0405]: cannot find trait `ToString` in this scope
--> $DIR/no-implicit-prelude-nested.rs:41:14
|
LL | impl ToString for Test {}
| ^^^^^^^^ not found in this scope
|
help: consider importing one of these items
|
LL | use std::prelude::v1::ToString;
help: consider importing this trait
|
LL | use std::string::ToString;
|
Expand All @@ -198,12 +176,10 @@ error[E0425]: cannot find function `drop` in this scope
LL | drop(2)
| ^^^^ not found in this scope
|
help: consider importing one of these items
help: consider importing this function
|
LL | use std::mem::drop;
|
LL | use std::prelude::v1::drop;
|

error: aborting due to 18 previous errors

Expand Down
16 changes: 4 additions & 12 deletions src/test/ui/no-implicit-prelude.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,29 @@ error[E0404]: expected trait, found derive macro `Clone`
LL | impl Clone for Test {}
| ^^^^^ not a trait
|
help: consider importing one of these items instead
help: consider importing this trait instead
|
LL | use std::clone::Clone;
|
LL | use std::prelude::v1::Clone;
|

error[E0405]: cannot find trait `Iterator` in this scope
--> $DIR/no-implicit-prelude.rs:12:6
|
LL | impl Iterator for Test {}
| ^^^^^^^^ not found in this scope
|
help: consider importing one of these items
help: consider importing this trait
|
LL | use std::iter::Iterator;
|
LL | use std::prelude::v1::Iterator;
|

error[E0405]: cannot find trait `ToString` in this scope
--> $DIR/no-implicit-prelude.rs:13:6
|
LL | impl ToString for Test {}
| ^^^^^^^^ not found in this scope
|
help: consider importing one of these items
|
LL | use std::prelude::v1::ToString;
help: consider importing this trait
|
LL | use std::string::ToString;
|
Expand All @@ -60,12 +54,10 @@ error[E0425]: cannot find function `drop` in this scope
LL | drop(2)
| ^^^^ not found in this scope
|
help: consider importing one of these items
help: consider importing this function
|
LL | use std::mem::drop;
|
LL | use std::prelude::v1::drop;
|

error: aborting due to 6 previous errors

Expand Down
4 changes: 1 addition & 3 deletions src/test/ui/resolve/use_suggestion_placement.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ error[E0412]: cannot find type `HashMap` in this scope
LL | type Dict<K, V> = HashMap<K, V>;
| ^^^^^^^ not found in this scope
|
help: consider importing one of these items
help: consider importing this struct
|
LL | use std::collections::HashMap;
|
LL | use std::collections::hash_map::HashMap;
|

error: aborting due to 3 previous errors

Expand Down

0 comments on commit 84e1c78

Please sign in to comment.