@@ -5,7 +5,7 @@ use rustc_middle::lint::in_external_macro;
5
5
use rustc_middle:: ty:: subst:: GenericArgKind ;
6
6
use rustc_session:: { declare_lint_pass, declare_tool_lint} ;
7
7
8
- use crate :: utils:: { implements_trait , is_must_use_func_call, is_must_use_ty, match_type, paths, span_lint_and_help} ;
8
+ use crate :: utils:: { is_must_use_func_call, is_must_use_ty, match_type, paths, span_lint_and_help} ;
9
9
10
10
declare_clippy_lint ! {
11
11
/// **What it does:** Checks for `let _ = <expr>`
@@ -125,15 +125,6 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
125
125
126
126
GenericArgKind :: Lifetime ( _) | GenericArgKind :: Const ( _) => false ,
127
127
} ) ;
128
- let implements_drop = cx. tcx. lang_items( ) . drop_trait( ) . map_or( false , |drop_trait|
129
- init_ty. walk( ) . any( |inner| match inner. unpack( ) {
130
- GenericArgKind :: Type ( inner_ty) => {
131
- implements_trait( cx, inner_ty, drop_trait, & [ ] )
132
- } ,
133
-
134
- GenericArgKind :: Lifetime ( _) | GenericArgKind :: Const ( _) => false ,
135
- } )
136
- ) ;
137
128
if contains_sync_guard {
138
129
span_lint_and_help(
139
130
cx,
@@ -144,7 +135,7 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
144
135
"consider using an underscore-prefixed named \
145
136
binding or dropping explicitly with `std::mem::drop`"
146
137
)
147
- } else if implements_drop {
138
+ } else if init_ty . needs_drop ( cx . tcx , cx . param_env ) {
148
139
span_lint_and_help(
149
140
cx,
150
141
LET_UNDERSCORE_DROP ,
0 commit comments