Skip to content

Commit d9e963f

Browse files
committed
Lint for significant drops who may have surprising lifetimes #1
author Preston From <prestonfrom@gmail.com> 1645164142 -0600 committer Preston From <prestonfrom@gmail.com> 1650005351 -0600
1 parent bbb1c5b commit d9e963f

8 files changed

+1201
-0
lines changed

src/tools/clippy/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -3696,6 +3696,7 @@ Released 2018-09-13
36963696
[`skip_while_next`]: https://rust-lang.github.io/rust-clippy/master/index.html#skip_while_next
36973697
[`slow_vector_initialization`]: https://rust-lang.github.io/rust-clippy/master/index.html#slow_vector_initialization
36983698
[`stable_sort_primitive`]: https://rust-lang.github.io/rust-clippy/master/index.html#stable_sort_primitive
3699+
[`significant_drop_in_scrutinee`]: https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_in_scrutinee
36993700
[`str_to_string`]: https://rust-lang.github.io/rust-clippy/master/index.html#str_to_string
37003701
[`string_add`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_add
37013702
[`string_add_assign`]: https://rust-lang.github.io/rust-clippy/master/index.html#string_add_assign

src/tools/clippy/clippy_lints/src/lib.register_lints.rs

+1
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ store.register_lints(&[
475475
size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT,
476476
slow_vector_initialization::SLOW_VECTOR_INITIALIZATION,
477477
stable_sort_primitive::STABLE_SORT_PRIMITIVE,
478+
significant_drop_in_scrutinee::SIGNIFICANT_DROP_IN_SCRUTINEE,
478479
strings::STRING_ADD,
479480
strings::STRING_ADD_ASSIGN,
480481
strings::STRING_FROM_UTF8_AS_BYTES,

src/tools/clippy/clippy_lints/src/lib.register_nursery.rs

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ store.register_group(true, "clippy::nursery", Some("clippy_nursery"), vec![
2525
LintId::of(path_buf_push_overwrite::PATH_BUF_PUSH_OVERWRITE),
2626
LintId::of(redundant_pub_crate::REDUNDANT_PUB_CRATE),
2727
LintId::of(regex::TRIVIAL_REGEX),
28+
LintId::of(significant_drop_in_scrutinee::SIGNIFICANT_DROP_IN_SCRUTINEE),
2829
LintId::of(strings::STRING_LIT_AS_BYTES),
2930
LintId::of(suspicious_operation_groupings::SUSPICIOUS_OPERATION_GROUPINGS),
3031
LintId::of(trailing_empty_array::TRAILING_EMPTY_ARRAY),

src/tools/clippy/clippy_lints/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ mod self_named_constructors;
364364
mod semicolon_if_nothing_returned;
365365
mod serde_api;
366366
mod shadow;
367+
mod significant_drop_in_scrutinee;
367368
mod single_char_lifetime_names;
368369
mod single_component_path_imports;
369370
mod size_of_in_element_count;
@@ -874,6 +875,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
874875
store.register_late_pass(move || Box::new(manual_bits::ManualBits::new(msrv)));
875876
store.register_late_pass(|| Box::new(default_union_representation::DefaultUnionRepresentation));
876877
store.register_late_pass(|| Box::new(only_used_in_recursion::OnlyUsedInRecursion));
878+
store.register_late_pass(|| Box::new(significant_drop_in_scrutinee::SignificantDropInScrutinee));
877879
store.register_late_pass(|| Box::new(dbg_macro::DbgMacro));
878880
let cargo_ignore_publish = conf.cargo_ignore_publish;
879881
store.register_late_pass(move || {

0 commit comments

Comments
 (0)