@@ -978,7 +978,7 @@ fn assoc_method(
978
978
+ name. as_str ( ) . len ( )
979
979
+ generics_len;
980
980
981
- let notable_traits = notable_traits_button ( & d. output , cx) ;
981
+ let notable_traits = notable_traits_button ( & d. output , cx) . maybe_display ( ) ;
982
982
983
983
let ( indent, indent_str, end_newline) = if parent == ItemType :: Trait {
984
984
header_len += 4 ;
@@ -1005,7 +1005,6 @@ fn assoc_method(
1005
1005
name = name,
1006
1006
generics = g. print( cx) ,
1007
1007
decl = d. full_print( header_len, indent, cx) ,
1008
- notable_traits = notable_traits. unwrap_or_default( ) ,
1009
1008
where_clause = print_where_clause( g, cx, indent, end_newline) ,
1010
1009
) ;
1011
1010
}
@@ -1453,7 +1452,10 @@ fn should_render_item(item: &clean::Item, deref_mut_: bool, tcx: TyCtxt<'_>) ->
1453
1452
}
1454
1453
}
1455
1454
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 > > {
1457
1459
let mut has_notable_trait = false ;
1458
1460
1459
1461
if ty. is_unit ( ) {
@@ -1495,15 +1497,16 @@ pub(crate) fn notable_traits_button(ty: &clean::Type, cx: &Context<'_>) -> Optio
1495
1497
}
1496
1498
}
1497
1499
1498
- if has_notable_trait {
1500
+ has_notable_trait. then ( || {
1499
1501
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
+ } )
1507
1510
}
1508
1511
1509
1512
fn notable_traits_decl ( ty : & clean:: Type , cx : & Context < ' _ > ) -> ( String , String ) {
0 commit comments