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