@@ -978,7 +978,7 @@ fn assoc_method(
978978 + name. as_str ( ) . len ( )
979979 + generics_len;
980980
981- let notable_traits = notable_traits_button ( & d. output , cx) ;
981+ let notable_traits = notable_traits_button ( & d. output , cx) . maybe_display ( ) ;
982982
983983 let ( indent, indent_str, end_newline) = if parent == ItemType :: Trait {
984984 header_len += 4 ;
@@ -1005,7 +1005,6 @@ fn assoc_method(
10051005 name = name,
10061006 generics = g. print( cx) ,
10071007 decl = d. full_print( header_len, indent, cx) ,
1008- notable_traits = notable_traits. unwrap_or_default( ) ,
10091008 where_clause = print_where_clause( g, cx, indent, end_newline) ,
10101009 ) ;
10111010}
@@ -1453,7 +1452,10 @@ fn should_render_item(item: &clean::Item, deref_mut_: bool, tcx: TyCtxt<'_>) ->
14531452 }
14541453}
14551454
1456- pub ( crate ) fn notable_traits_button ( ty : & clean:: Type , cx : & Context < ' _ > ) -> Option < String > {
1455+ pub ( crate ) fn notable_traits_button < ' a , ' tcx > (
1456+ ty : & ' a clean:: Type ,
1457+ cx : & ' a Context < ' tcx > ,
1458+ ) -> Option < impl fmt:: Display + ' a + Captures < ' tcx > > {
14571459 let mut has_notable_trait = false ;
14581460
14591461 if ty. is_unit ( ) {
@@ -1495,15 +1497,16 @@ pub(crate) fn notable_traits_button(ty: &clean::Type, cx: &Context<'_>) -> Optio
14951497 }
14961498 }
14971499
1498- if has_notable_trait {
1500+ has_notable_trait. then ( || {
14991501 cx. types_with_notable_traits . borrow_mut ( ) . insert ( ty. clone ( ) ) ;
1500- Some ( format ! (
1501- " <a href=\" #\" class=\" tooltip\" data-notable-ty=\" {ty}\" >ⓘ</a>" ,
1502- ty = Escape ( & format!( "{:#}" , ty. print( cx) ) ) ,
1503- ) )
1504- } else {
1505- None
1506- }
1502+ fmt:: from_fn ( |f| {
1503+ write ! (
1504+ f,
1505+ " <a href=\" #\" class=\" tooltip\" data-notable-ty=\" {ty}\" >ⓘ</a>" ,
1506+ ty = Escape ( & format!( "{:#}" , ty. print( cx) ) ) ,
1507+ )
1508+ } )
1509+ } )
15071510}
15081511
15091512fn notable_traits_decl ( ty : & clean:: Type , cx : & Context < ' _ > ) -> ( String , String ) {
0 commit comments