diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index c7a258145537..846c0721ccbd 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2110,24 +2110,27 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
")?;
// If there's already another implementor that has the same abbridged name, use the
// full path, for example in `std::iter::ExactSizeIterator`
- let mut dissambiguate = false;
- for l in implementors.iter() {
- match (k.impl_.for_.clone(), l.impl_.for_.clone()) {
- (clean::Type::ResolvedPath {path: path_a, ..},
- clean::Type::ResolvedPath {path: path_b, ..}) => {
- if k.def_id != l.def_id && path_a.last_name() == path_b.last_name() {
- dissambiguate = true;
- }
- }
- _ => (),
- }
- }
- fmt_impl_for_trait_page(&k.impl_, w, dissambiguate)?;
+ let dissambiguate = if let clean::Type::ResolvedPath {
+ ref path, ..
+ } = implementor.impl_.for_ {
+ *implementor_count.get(&path.last_name()).unwrap_or(&0) > 1
+ } else {
+ false
+ };
+ fmt_impl_for_trait_page(&implementor.impl_, w, dissambiguate)?;
writeln!(w, "