File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ use std::ops::ControlFlow;
22
33use clippy_utils:: {
44 diagnostics:: span_lint_and_then,
5- match_def_path, paths,
5+ paths,
6+ ty:: match_type,
67 visitors:: { for_each_expr, Visitable } ,
78} ;
89use if_chain:: if_chain;
@@ -116,20 +117,19 @@ fn should_lint<'tcx>(
116117 let ExprKind :: MethodCall ( path, recv, ..) = & expr. kind else {
117118 return ControlFlow :: Continue ( ( ) ) ;
118119 } ;
120+ let recv_ty = typeck_results. expr_ty ( recv) . peel_refs ( ) ;
119121
120122 if_chain ! {
121123 if [ sym:: debug_struct, sym:: debug_tuple] . contains( & path. ident. name) ;
122- if let Some ( ty) = typeck_results. expr_ty( recv) . peel_refs( ) . ty_adt_def( ) ;
123- if match_def_path( cx, ty. did( ) , & paths:: FORMATTER ) ;
124+ if match_type( cx, recv_ty, & paths:: FORMATTER ) ;
124125 then {
125126 has_debug_struct_tuple = true ;
126127 }
127128 }
128129
129130 if_chain ! {
130131 if path. ident. name. as_str( ) == "finish_non_exhaustive" ;
131- if let Some ( ty) = typeck_results. expr_ty( recv) . peel_refs( ) . ty_adt_def( ) ;
132- if match_def_path( cx, ty. did( ) , & paths:: DEBUG_STRUCT ) ;
132+ if match_type( cx, recv_ty, & paths:: DEBUG_STRUCT ) ;
133133 then {
134134 has_finish_non_exhaustive = true ;
135135 }
You can’t perform that action at this time.
0 commit comments