@@ -83,7 +83,7 @@ declare_clippy_lint! {
83
83
/// ```
84
84
#[ clippy:: version = "1.60.0" ]
85
85
pub SIGNIFICANT_DROP_IN_SCRUTINEE ,
86
- nursery ,
86
+ suspicious ,
87
87
"warns when a temporary of a type with a drop with a significant side-effect might have a surprising lifetime"
88
88
}
89
89
@@ -99,7 +99,7 @@ impl<'tcx> LateLintPass<'tcx> for SignificantDropInScrutinee {
99
99
found. found_span ,
100
100
"temporary with significant drop in match scrutinee" ,
101
101
|diag| set_diagnostic ( diag, cx, expr, found) ,
102
- )
102
+ ) ;
103
103
}
104
104
}
105
105
}
@@ -148,8 +148,8 @@ fn set_diagnostic<'tcx>(diag: &mut Diagnostic, cx: &LateContext<'tcx>, expr: &'t
148
148
) ;
149
149
}
150
150
151
- /// If the expression is an ExprKind::Match, check if the scrutinee has a significant drop that may
152
- /// have a surprising lifetime.
151
+ /// If the expression is an ` ExprKind::Match` , check if the scrutinee has a significant drop that
152
+ /// may have a surprising lifetime.
153
153
fn has_significant_drop_in_scrutinee < ' tcx , ' a > (
154
154
cx : & ' a LateContext < ' tcx > ,
155
155
expr : & ' tcx Expr < ' tcx > ,
@@ -171,6 +171,7 @@ struct SigDropHelper<'a, 'tcx> {
171
171
special_handling_for_binary_op : bool ,
172
172
}
173
173
174
+ #[ expect( clippy:: enum_variant_names) ]
174
175
#[ derive( Debug , PartialEq , Eq , Clone , Copy ) ]
175
176
enum LintSuggestion {
176
177
MoveOnly ,
@@ -213,7 +214,7 @@ impl<'a, 'tcx> SigDropHelper<'a, 'tcx> {
213
214
}
214
215
215
216
/// This will try to set the current suggestion (so it can be moved into the suggestions vec
216
- /// later). If allow_move_and_clone is false, the suggestion *won't* be set -- this gives us
217
+ /// later). If ` allow_move_and_clone` is false, the suggestion *won't* be set -- this gives us
217
218
/// an opportunity to look for another type in the chain that will be trivially copyable.
218
219
/// However, if we are at the the end of the chain, we want to accept whatever is there. (The
219
220
/// suggestion won't actually be output, but the diagnostic message will be output, so the user
@@ -313,10 +314,10 @@ impl<'a, 'tcx> SigDropHelper<'a, 'tcx> {
313
314
}
314
315
false
315
316
} ,
316
- rustc_middle:: ty:: Array ( ty, _) => self . has_sig_drop_attr ( cx , * ty ) ,
317
- rustc_middle:: ty:: RawPtr ( TypeAndMut { ty, .. } ) => self . has_sig_drop_attr ( cx , * ty ) ,
318
- rustc_middle:: ty:: Ref ( _, ty, _) => self . has_sig_drop_attr ( cx , * ty ) ,
319
- rustc_middle:: ty:: Slice ( ty) => self . has_sig_drop_attr ( cx, * ty) ,
317
+ rustc_middle:: ty:: Array ( ty, _)
318
+ | rustc_middle:: ty:: RawPtr ( TypeAndMut { ty, .. } )
319
+ | rustc_middle:: ty:: Ref ( _, ty, _)
320
+ | rustc_middle:: ty:: Slice ( ty) => self . has_sig_drop_attr ( cx, * ty) ,
320
321
_ => false ,
321
322
}
322
323
}
@@ -332,15 +333,12 @@ impl<'a, 'tcx> Visitor<'tcx> for SigDropHelper<'a, 'tcx> {
332
333
333
334
match ex. kind {
334
335
ExprKind :: MethodCall ( _, [ ref expr, ..] , _) => {
335
- self . visit_expr ( expr)
336
+ self . visit_expr ( expr) ;
336
337
}
337
338
ExprKind :: Binary ( _, left, right) => {
338
339
self . visit_exprs_for_binary_ops ( left, right, false , ex. span ) ;
339
340
}
340
- ExprKind :: Assign ( left, right, _) => {
341
- self . visit_exprs_for_binary_ops ( left, right, true , ex. span ) ;
342
- }
343
- ExprKind :: AssignOp ( _, left, right) => {
341
+ ExprKind :: Assign ( left, right, _) | ExprKind :: AssignOp ( _, left, right) => {
344
342
self . visit_exprs_for_binary_ops ( left, right, true , ex. span ) ;
345
343
}
346
344
ExprKind :: Tup ( exprs) => {
0 commit comments