@@ -13,7 +13,7 @@ use rustc_hir::{
1313 QPath , TraitItemRef , TyKind ,
1414} ;
1515use rustc_lint:: { LateContext , LateLintPass } ;
16- use rustc_middle:: ty:: { self , AssocKind , FnSig , Ty } ;
16+ use rustc_middle:: ty:: { self , FnSig , Ty } ;
1717use rustc_session:: declare_lint_pass;
1818use rustc_span:: source_map:: Spanned ;
1919use rustc_span:: symbol:: sym;
@@ -288,8 +288,7 @@ fn check_trait_items(cx: &LateContext<'_>, visited_trait: &Item<'_>, ident: Iden
288288 . items ( )
289289 . flat_map ( |& i| cx. tcx . associated_items ( i) . filter_by_name_unhygienic ( is_empty) )
290290 . any ( |i| {
291- i. kind == AssocKind :: Fn
292- && i. fn_has_self_parameter
291+ i. is_method ( )
293292 && cx. tcx . fn_sig ( i. def_id ) . skip_binder ( ) . inputs ( ) . skip_binder ( ) . len ( ) == 1
294293 } ) ;
295294
@@ -466,7 +465,7 @@ fn check_for_is_empty(
466465 . inherent_impls ( impl_ty)
467466 . iter ( )
468467 . flat_map ( |& id| cx. tcx . associated_items ( id) . filter_by_name_unhygienic ( is_empty) )
469- . find ( |item| item. kind == AssocKind :: Fn ) ;
468+ . find ( |item| item. is_fn ( ) ) ;
470469
471470 let ( msg, is_empty_span, self_kind) = match is_empty {
472471 None => (
@@ -486,7 +485,7 @@ fn check_for_is_empty(
486485 None ,
487486 ) ,
488487 Some ( is_empty)
489- if !( is_empty. fn_has_self_parameter
488+ if !( is_empty. is_method ( )
490489 && check_is_empty_sig (
491490 cx,
492491 cx. tcx . fn_sig ( is_empty. def_id ) . instantiate_identity ( ) . skip_binder ( ) ,
@@ -608,7 +607,7 @@ fn is_empty_array(expr: &Expr<'_>) -> bool {
608607fn has_is_empty ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) -> bool {
609608 /// Gets an `AssocItem` and return true if it matches `is_empty(self)`.
610609 fn is_is_empty ( cx : & LateContext < ' _ > , item : & ty:: AssocItem ) -> bool {
611- if item. kind == AssocKind :: Fn {
610+ if item. is_fn ( ) {
612611 let sig = cx. tcx . fn_sig ( item. def_id ) . skip_binder ( ) ;
613612 let ty = sig. skip_binder ( ) ;
614613 ty. inputs ( ) . len ( ) == 1
@@ -644,7 +643,7 @@ fn has_is_empty(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
644643 && cx. tcx . get_diagnostic_item ( sym:: Deref ) . is_some_and ( |deref_id| {
645644 implements_trait ( cx, ty, deref_id, & [ ] )
646645 && cx
647- . get_associated_type ( ty, deref_id, " Target" )
646+ . get_associated_type ( ty, deref_id, sym :: Target )
648647 . is_some_and ( |deref_ty| ty_has_is_empty ( cx, deref_ty, depth + 1 ) )
649648 } ) )
650649 } ,
0 commit comments