Commit Graph

4 Commits

Author SHA1 Message Date
Jorge Aparicio
a079d5e4d2 remove imports 2015-03-16 21:57:42 -05:00
Jorge Aparicio
5b118f5ecd impl str 2015-03-16 21:56:31 -05:00
Huon Wilson
e81ae40770 Try to only suggest implementable traits for method calls.
That is, when offering suggestions for unresolved method calls, avoid
suggesting traits for which implementing the trait for the receiver type
either makes little sense (e.g. type errors, or sugared unboxed
closures), or violates coherence.

The latter is approximated by ensuring that at least one of `{receiver
type, trait}` is local. This isn't precisely correct due to
multidispatch, but the error messages one encounters in such situation
are useless more often than not; it is better to be conservative and
miss some cases, than have overly many false positives (e.g. writing
`some_slice.map(|x| ...)` uselessly suggested that one should implement
`IteratorExt` for `&[T]`, while the correct fix is to call `.iter()`).

Closes #21420.
2015-02-03 22:33:54 +11:00
Huon Wilson
849a38ad86 Avoid suggesting traits multiple times.
This is clearly useless, the user doesn't need to know that they could
implement/import `foo::bar::Baz` 4 times.

Fixes #21405.
2015-01-20 23:10:37 +11:00