@@ -984,7 +984,7 @@ fn assoc_method(
984
984
+ name. as_str ( ) . len ( )
985
985
+ generics_len;
986
986
987
- let notable_traits = notable_traits_button ( & d. output , cx) ;
987
+ let notable_traits = notable_traits_button ( & d. output , cx) . maybe_display ( ) ;
988
988
989
989
let ( indent, indent_str, end_newline) = if parent == ItemType :: Trait {
990
990
header_len += 4 ;
@@ -1012,7 +1012,6 @@ fn assoc_method(
1012
1012
name = name,
1013
1013
generics = g. print( cx) ,
1014
1014
decl = d. full_print( header_len, indent, cx) ,
1015
- notable_traits = notable_traits. unwrap_or_default( ) ,
1016
1015
where_clause = print_where_clause( g, cx, indent, end_newline) ,
1017
1016
) ,
1018
1017
) ;
@@ -1460,7 +1459,10 @@ fn should_render_item(item: &clean::Item, deref_mut_: bool, tcx: TyCtxt<'_>) ->
1460
1459
}
1461
1460
}
1462
1461
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 > > {
1464
1466
let mut has_notable_trait = false ;
1465
1467
1466
1468
if ty. is_unit ( ) {
@@ -1502,15 +1504,16 @@ pub(crate) fn notable_traits_button(ty: &clean::Type, cx: &Context<'_>) -> Optio
1502
1504
}
1503
1505
}
1504
1506
1505
- if has_notable_trait {
1507
+ has_notable_trait. then ( || {
1506
1508
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
+ } )
1514
1517
}
1515
1518
1516
1519
fn notable_traits_decl ( ty : & clean:: Type , cx : & Context < ' _ > ) -> ( String , String ) {
0 commit comments