Skip to content

Commit 97a0cf2

Browse files
committed
Auto merge of #9302 - Jarcho:sig_drop_nursery, r=flip1995
Move `significant_drop_in_scrutinee` into `nursey` The current suggestion of extending the lifetime of every sub-expression is not great and doesn't fix the error given in the lint's example, though it does make the potential deadlock easier to see, but it can also cause it's own issues by delaying the drop of the lock guard. e.g. ```rust match x.lock().foo { .. } // some stuff let y = x.lock(); ``` The suggestion would create a deadlock at the second `x.lock()` call. This also lints even when a significant drop type isn't created as a temporary. (#9072) I agree `@kpreid` (#8987 (comment)) that this should be back-ported before the lint hits stable. changelog: Move `significant_drop_in_scrutinee` into `nursey`
2 parents 5721ca9 + aa0b0af commit 97a0cf2

File tree

4 files changed

+2
-3
lines changed

4 files changed

+2
-3
lines changed

clippy_lints/src/lib.register_all.rs

-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
144144
LintId::of(matches::MATCH_STR_CASE_MISMATCH),
145145
LintId::of(matches::NEEDLESS_MATCH),
146146
LintId::of(matches::REDUNDANT_PATTERN_MATCHING),
147-
LintId::of(matches::SIGNIFICANT_DROP_IN_SCRUTINEE),
148147
LintId::of(matches::SINGLE_MATCH),
149148
LintId::of(matches::WILDCARD_IN_OR_PATTERNS),
150149
LintId::of(mem_replace::MEM_REPLACE_OPTION_WITH_NONE),

clippy_lints/src/lib.register_nursery.rs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
1313
LintId::of(future_not_send::FUTURE_NOT_SEND),
1414
LintId::of(index_refutable_slice::INDEX_REFUTABLE_SLICE),
1515
LintId::of(let_if_seq::USELESS_LET_IF_SEQ),
16+
LintId::of(matches::SIGNIFICANT_DROP_IN_SCRUTINEE),
1617
LintId::of(methods::ITER_WITH_DRAIN),
1718
LintId::of(missing_const_for_fn::MISSING_CONST_FOR_FN),
1819
LintId::of(mutable_debug_assertion::DEBUG_ASSERT_WITH_MUT_CALL),

clippy_lints/src/lib.register_suspicious.rs

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ store.register_group(true, "clippy::suspicious", Some("clippy_suspicious"), vec!
2222
LintId::of(loops::EMPTY_LOOP),
2323
LintId::of(loops::FOR_LOOPS_OVER_FALLIBLES),
2424
LintId::of(loops::MUT_RANGE_BOUND),
25-
LintId::of(matches::SIGNIFICANT_DROP_IN_SCRUTINEE),
2625
LintId::of(methods::NO_EFFECT_REPLACE),
2726
LintId::of(methods::SUSPICIOUS_MAP),
2827
LintId::of(mut_key::MUTABLE_KEY_TYPE),

clippy_lints/src/matches/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ declare_clippy_lint! {
835835
/// ```
836836
#[clippy::version = "1.60.0"]
837837
pub SIGNIFICANT_DROP_IN_SCRUTINEE,
838-
suspicious,
838+
nursery,
839839
"warns when a temporary of a type with a drop with a significant side-effect might have a surprising lifetime"
840840
}
841841

0 commit comments

Comments
 (0)