@@ -4,12 +4,13 @@ use clippy_utils::source::indent_of;
4
4
use clippy_utils:: { is_default_equivalent, peel_blocks} ;
5
5
use rustc_errors:: Applicability ;
6
6
use rustc_hir:: {
7
+ self as hir,
7
8
def:: { CtorKind , CtorOf , DefKind , Res } ,
8
- Body , Expr , ExprKind , GenericArg , Impl , ImplItemKind , Item , ItemKind , Node , PathSegment , QPath , Ty , TyKind ,
9
+ Body , Expr , ExprKind , GenericArg , Impl , ImplItemKind , Item , ItemKind , Node , PathSegment , QPath , TyKind ,
9
10
} ;
10
11
use rustc_lint:: { LateContext , LateLintPass } ;
11
12
use rustc_middle:: ty:: adjustment:: { Adjust , PointerCast } ;
12
- use rustc_middle:: ty:: { self , Adt , AdtDef , SubstsRef , TypeckResults } ;
13
+ use rustc_middle:: ty:: { self , Adt , AdtDef , SubstsRef , Ty , TypeckResults } ;
13
14
use rustc_session:: { declare_tool_lint, impl_lint_pass} ;
14
15
use rustc_span:: sym;
15
16
@@ -76,19 +77,19 @@ fn is_path_self(e: &Expr<'_>) -> bool {
76
77
}
77
78
}
78
79
79
- fn contains_trait_object ( ty : ty :: Ty < ' _ > ) -> bool {
80
+ fn contains_trait_object ( ty : Ty < ' _ > ) -> bool {
80
81
match ty. kind ( ) {
81
- ty:: TyKind :: Ref ( _, ty, _) => contains_trait_object ( * ty) ,
82
- ty:: TyKind :: Adt ( def, substs) => def. is_box ( ) && substs[ 0 ] . as_type ( ) . map_or ( false , contains_trait_object) ,
83
- ty:: TyKind :: Dynamic ( ..) => true ,
82
+ ty:: Ref ( _, ty, _) => contains_trait_object ( * ty) ,
83
+ ty:: Adt ( def, substs) => def. is_box ( ) && substs[ 0 ] . as_type ( ) . map_or ( false , contains_trait_object) ,
84
+ ty:: Dynamic ( ..) => true ,
84
85
_ => false ,
85
86
}
86
87
}
87
88
88
89
fn check_struct < ' tcx > (
89
90
cx : & LateContext < ' tcx > ,
90
91
item : & ' tcx Item < ' _ > ,
91
- self_ty : & Ty < ' _ > ,
92
+ self_ty : & hir :: Ty < ' _ > ,
92
93
func_expr : & Expr < ' _ > ,
93
94
adt_def : AdtDef < ' _ > ,
94
95
substs : SubstsRef < ' _ > ,
0 commit comments