@@ -2110,24 +2110,27 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
21102110 <h2 id='implementors'>Implementors</h2>
21112111 <ul class='item-list' id='implementors-list'>
21122112 " ) ?;
2113+ let mut implementor_count: FxHashMap < String , usize > = FxHashMap ( ) ;
2114+ for ( _, implementors) in cache. implementors . iter ( ) {
2115+ for implementor in implementors {
2116+ if let clean:: Type :: ResolvedPath { ref path, ..} = implementor. impl_ . for_ {
2117+ * implementor_count. entry ( path. last_name ( ) ) . or_insert ( 0 ) += 1 ;
2118+ }
2119+ }
2120+ }
21132121 if let Some ( implementors) = cache. implementors . get ( & it. def_id ) {
2114- for k in implementors. iter ( ) {
2122+ for implementor in implementors. iter ( ) {
21152123 write ! ( w, "<li><code>" ) ?;
21162124 // If there's already another implementor that has the same abbridged name, use the
21172125 // full path, for example in `std::iter::ExactSizeIterator`
2118- let mut dissambiguate = false ;
2119- for l in implementors. iter ( ) {
2120- match ( k. impl_ . for_ . clone ( ) , l. impl_ . for_ . clone ( ) ) {
2121- ( clean:: Type :: ResolvedPath { path : path_a, ..} ,
2122- clean:: Type :: ResolvedPath { path : path_b, ..} ) => {
2123- if k. def_id != l. def_id && path_a. last_name ( ) == path_b. last_name ( ) {
2124- dissambiguate = true ;
2125- }
2126- }
2127- _ => ( ) ,
2128- }
2129- }
2130- fmt_impl_for_trait_page ( & k. impl_ , w, dissambiguate) ?;
2126+ let dissambiguate = if let clean:: Type :: ResolvedPath {
2127+ ref path, ..
2128+ } = implementor. impl_ . for_ {
2129+ * implementor_count. get ( & path. last_name ( ) ) . unwrap_or ( & 0 ) > 1
2130+ } else {
2131+ false
2132+ } ;
2133+ fmt_impl_for_trait_page ( & implementor. impl_ , w, dissambiguate) ?;
21312134 writeln ! ( w, "</code></li>" ) ?;
21322135 }
21332136 }
0 commit comments