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;
2
2
3
3
use clippy_utils:: {
4
4
diagnostics:: span_lint_and_then,
5
- match_def_path, paths,
5
+ paths,
6
+ ty:: match_type,
6
7
visitors:: { for_each_expr, Visitable } ,
7
8
} ;
8
9
use if_chain:: if_chain;
@@ -116,20 +117,19 @@ fn should_lint<'tcx>(
116
117
let ExprKind :: MethodCall ( path, recv, ..) = & expr. kind else {
117
118
return ControlFlow :: Continue ( ( ) ) ;
118
119
} ;
120
+ let recv_ty = typeck_results. expr_ty ( recv) . peel_refs ( ) ;
119
121
120
122
if_chain ! {
121
123
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 ) ;
124
125
then {
125
126
has_debug_struct_tuple = true ;
126
127
}
127
128
}
128
129
129
130
if_chain ! {
130
131
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 ) ;
133
133
then {
134
134
has_finish_non_exhaustive = true ;
135
135
}
You can’t perform that action at this time.
0 commit comments