@@ -1432,8 +1432,6 @@ fn should_render_item(item: &clean::Item, deref_mut_: bool, tcx: TyCtxt<'_>) ->
1432
1432
}
1433
1433
1434
1434
pub ( crate ) fn notable_traits_button ( ty : & clean:: Type , cx : & Context < ' _ > ) -> Option < String > {
1435
- let mut has_notable_trait = false ;
1436
-
1437
1435
if ty. is_unit ( ) {
1438
1436
// Very common fast path.
1439
1437
return None ;
@@ -1451,27 +1449,19 @@ pub(crate) fn notable_traits_button(ty: &clean::Type, cx: &Context<'_>) -> Optio
1451
1449
return None ;
1452
1450
}
1453
1451
1454
- if let Some ( impls) = cx. cache ( ) . impls . get ( & did) {
1455
- for i in impls {
1456
- let impl_ = i. inner_impl ( ) ;
1457
- if impl_. polarity != ty:: ImplPolarity :: Positive {
1458
- continue ;
1459
- }
1460
-
1461
- if !ty. is_doc_subtype_of ( & impl_. for_ , cx. cache ( ) ) {
1462
- // Two different types might have the same did,
1463
- // without actually being the same.
1464
- continue ;
1465
- }
1466
- if let Some ( trait_) = & impl_. trait_ {
1467
- let trait_did = trait_. def_id ( ) ;
1468
-
1469
- if cx. cache ( ) . traits . get ( & trait_did) . is_some_and ( |t| t. is_notable_trait ( cx. tcx ( ) ) ) {
1470
- has_notable_trait = true ;
1471
- }
1472
- }
1473
- }
1474
- }
1452
+ let impls = cx. cache ( ) . impls . get ( & did) ?;
1453
+ let has_notable_trait = impls
1454
+ . iter ( )
1455
+ . map ( Impl :: inner_impl)
1456
+ . filter ( |impl_| impl_. polarity == ty:: ImplPolarity :: Positive )
1457
+ . filter ( |impl_| {
1458
+ // Two different types might have the same did,
1459
+ // without actually being the same.
1460
+ ty. is_doc_subtype_of ( & impl_. for_ , cx. cache ( ) )
1461
+ } )
1462
+ . filter_map ( |impl_| impl_. trait_ . as_ref ( ) )
1463
+ . filter_map ( |trait_| cx. cache ( ) . traits . get ( & trait_. def_id ( ) ) )
1464
+ . any ( |t| t. is_notable_trait ( cx. tcx ( ) ) ) ;
1475
1465
1476
1466
if has_notable_trait {
1477
1467
cx. types_with_notable_traits . borrow_mut ( ) . insert ( ty. clone ( ) ) ;
0 commit comments