@@ -984,7 +984,7 @@ fn assoc_method(
984984 + name. as_str ( ) . len ( )
985985 + generics_len;
986986
987- let notable_traits = notable_traits_button ( & d. output , cx) ;
987+ let notable_traits = notable_traits_button ( & d. output , cx) . maybe_display ( ) ;
988988
989989 let ( indent, indent_str, end_newline) = if parent == ItemType :: Trait {
990990 header_len += 4 ;
@@ -1012,7 +1012,6 @@ fn assoc_method(
10121012 name = name,
10131013 generics = g. print( cx) ,
10141014 decl = d. full_print( header_len, indent, cx) ,
1015- notable_traits = notable_traits. unwrap_or_default( ) ,
10161015 where_clause = print_where_clause( g, cx, indent, end_newline) ,
10171016 ) ,
10181017 ) ;
@@ -1460,7 +1459,10 @@ fn should_render_item(item: &clean::Item, deref_mut_: bool, tcx: TyCtxt<'_>) ->
14601459 }
14611460}
14621461
1463- pub ( crate ) fn notable_traits_button ( ty : & clean:: Type , cx : & Context < ' _ > ) -> Option < String > {
1462+ pub ( crate ) fn notable_traits_button < ' a , ' tcx > (
1463+ ty : & ' a clean:: Type ,
1464+ cx : & ' a Context < ' tcx > ,
1465+ ) -> Option < impl fmt:: Display + ' a + Captures < ' tcx > > {
14641466 let mut has_notable_trait = false ;
14651467
14661468 if ty. is_unit ( ) {
@@ -1502,15 +1504,16 @@ pub(crate) fn notable_traits_button(ty: &clean::Type, cx: &Context<'_>) -> Optio
15021504 }
15031505 }
15041506
1505- if has_notable_trait {
1507+ has_notable_trait. then ( || {
15061508 cx. types_with_notable_traits . borrow_mut ( ) . insert ( ty. clone ( ) ) ;
1507- Some ( format ! (
1508- " <a href=\" #\" class=\" tooltip\" data-notable-ty=\" {ty}\" >ⓘ</a>" ,
1509- ty = Escape ( & format!( "{:#}" , ty. print( cx) ) ) ,
1510- ) )
1511- } else {
1512- None
1513- }
1509+ fmt:: from_fn ( |f| {
1510+ write ! (
1511+ f,
1512+ " <a href=\" #\" class=\" tooltip\" data-notable-ty=\" {ty}\" >ⓘ</a>" ,
1513+ ty = Escape ( & format!( "{:#}" , ty. print( cx) ) ) ,
1514+ )
1515+ } )
1516+ } )
15141517}
15151518
15161519fn notable_traits_decl ( ty : & clean:: Type , cx : & Context < ' _ > ) -> ( String , String ) {
0 commit comments