@@ -687,10 +687,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
687
687
let mut applied_do_not_recommend = false ;
688
688
loop {
689
689
if let ObligationCauseCode :: ImplDerived ( ref c) = base_cause {
690
- if self . tcx . has_attrs_with_path (
691
- c. impl_or_alias_def_id ,
692
- & [ sym:: diagnostic, sym:: do_not_recommend] ,
693
- ) {
690
+ if self . tcx . do_not_recommend_impl ( c. impl_or_alias_def_id ) {
694
691
let code = ( * c. derived . parent_code ) . clone ( ) ;
695
692
obligation. cause . map_code ( |_| code) ;
696
693
obligation. predicate = c. derived . parent_trait_pred . upcast ( self . tcx ) ;
@@ -1630,11 +1627,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
1630
1627
. tcx
1631
1628
. all_impls ( def_id)
1632
1629
// ignore `do_not_recommend` items
1633
- . filter ( |def_id| {
1634
- !self
1635
- . tcx
1636
- . has_attrs_with_path ( * def_id, & [ sym:: diagnostic, sym:: do_not_recommend] )
1637
- } )
1630
+ . filter ( |def_id| !self . tcx . do_not_recommend_impl ( * def_id) )
1638
1631
// Ignore automatically derived impls and `!Trait` impls.
1639
1632
. filter_map ( |def_id| self . tcx . impl_trait_header ( def_id) )
1640
1633
. filter_map ( |header| {
@@ -1904,12 +1897,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
1904
1897
let impl_candidates = impl_candidates
1905
1898
. into_iter ( )
1906
1899
. cloned ( )
1907
- . filter ( |cand| {
1908
- !self . tcx . has_attrs_with_path (
1909
- cand. impl_def_id ,
1910
- & [ sym:: diagnostic, sym:: do_not_recommend] ,
1911
- )
1912
- } )
1900
+ . filter ( |cand| !self . tcx . do_not_recommend_impl ( cand. impl_def_id ) )
1913
1901
. collect :: < Vec < _ > > ( ) ;
1914
1902
1915
1903
let def_id = trait_ref. def_id ( ) ;
0 commit comments