@@ -83,7 +83,7 @@ declare_clippy_lint! {
8383 /// ```
8484 #[ clippy:: version = "1.60.0" ]
8585 pub SIGNIFICANT_DROP_IN_SCRUTINEE ,
86- nursery ,
86+ suspicious ,
8787 "warns when a temporary of a type with a drop with a significant side-effect might have a surprising lifetime"
8888}
8989
@@ -99,7 +99,7 @@ impl<'tcx> LateLintPass<'tcx> for SignificantDropInScrutinee {
9999 found. found_span ,
100100 "temporary with significant drop in match scrutinee" ,
101101 |diag| set_diagnostic ( diag, cx, expr, found) ,
102- )
102+ ) ;
103103 }
104104 }
105105 }
@@ -148,8 +148,8 @@ fn set_diagnostic<'tcx>(diag: &mut Diagnostic, cx: &LateContext<'tcx>, expr: &'t
148148 ) ;
149149}
150150
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.
153153fn has_significant_drop_in_scrutinee < ' tcx , ' a > (
154154 cx : & ' a LateContext < ' tcx > ,
155155 expr : & ' tcx Expr < ' tcx > ,
@@ -171,6 +171,7 @@ struct SigDropHelper<'a, 'tcx> {
171171 special_handling_for_binary_op : bool ,
172172}
173173
174+ #[ expect( clippy:: enum_variant_names) ]
174175#[ derive( Debug , PartialEq , Eq , Clone , Copy ) ]
175176enum LintSuggestion {
176177 MoveOnly ,
@@ -213,7 +214,7 @@ impl<'a, 'tcx> SigDropHelper<'a, 'tcx> {
213214 }
214215
215216 /// 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
217218 /// an opportunity to look for another type in the chain that will be trivially copyable.
218219 /// However, if we are at the the end of the chain, we want to accept whatever is there. (The
219220 /// 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> {
313314 }
314315 false
315316 } ,
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) ,
320321 _ => false ,
321322 }
322323 }
@@ -332,15 +333,12 @@ impl<'a, 'tcx> Visitor<'tcx> for SigDropHelper<'a, 'tcx> {
332333
333334 match ex. kind {
334335 ExprKind :: MethodCall ( _, [ ref expr, ..] , _) => {
335- self . visit_expr ( expr)
336+ self . visit_expr ( expr) ;
336337 }
337338 ExprKind :: Binary ( _, left, right) => {
338339 self . visit_exprs_for_binary_ops ( left, right, false , ex. span ) ;
339340 }
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) => {
344342 self . visit_exprs_for_binary_ops ( left, right, true , ex. span ) ;
345343 }
346344 ExprKind :: Tup ( exprs) => {
0 commit comments