Skip to content

Commit dff7e74

Browse files
committed
Auto merge of #5903 - jrqc:needless_return, r=ebroto,flip1995
Needless return Fixes #5858 changelog: fix false positive [`needless_return`]
2 parents c8e05fc + baa4cb1 commit dff7e74

File tree

8 files changed

+412
-343
lines changed

8 files changed

+412
-343
lines changed

clippy_lints/src/let_and_return.rs

-124
This file was deleted.

clippy_lints/src/lib.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ mod large_const_arrays;
218218
mod large_enum_variant;
219219
mod large_stack_arrays;
220220
mod len_zero;
221-
mod let_and_return;
222221
mod let_if_seq;
223222
mod let_underscore;
224223
mod lifetimes;
@@ -311,6 +310,7 @@ mod unnested_or_patterns;
311310
mod unsafe_removed_from_name;
312311
mod unused_io_amount;
313312
mod unused_self;
313+
mod unused_unit;
314314
mod unwrap;
315315
mod use_self;
316316
mod useless_conversion;
@@ -587,7 +587,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
587587
&large_stack_arrays::LARGE_STACK_ARRAYS,
588588
&len_zero::LEN_WITHOUT_IS_EMPTY,
589589
&len_zero::LEN_ZERO,
590-
&let_and_return::LET_AND_RETURN,
591590
&let_if_seq::USELESS_LET_IF_SEQ,
592591
&let_underscore::LET_UNDERSCORE_LOCK,
593592
&let_underscore::LET_UNDERSCORE_MUST_USE,
@@ -771,8 +770,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
771770
&regex::INVALID_REGEX,
772771
&regex::TRIVIAL_REGEX,
773772
&repeat_once::REPEAT_ONCE,
773+
&returns::LET_AND_RETURN,
774774
&returns::NEEDLESS_RETURN,
775-
&returns::UNUSED_UNIT,
776775
&serde_api::SERDE_API_MISUSE,
777776
&shadow::SHADOW_REUSE,
778777
&shadow::SHADOW_SAME,
@@ -843,6 +842,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
843842
&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME,
844843
&unused_io_amount::UNUSED_IO_AMOUNT,
845844
&unused_self::UNUSED_SELF,
845+
&unused_unit::UNUSED_UNIT,
846846
&unwrap::PANICKING_UNWRAP,
847847
&unwrap::UNNECESSARY_UNWRAP,
848848
&use_self::USE_SELF,
@@ -1029,8 +1029,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
10291029
store.register_early_pass(|| box misc_early::MiscEarlyLints);
10301030
store.register_early_pass(|| box redundant_closure_call::RedundantClosureCall);
10311031
store.register_late_pass(|| box redundant_closure_call::RedundantClosureCall);
1032-
store.register_early_pass(|| box returns::Return);
1033-
store.register_late_pass(|| box let_and_return::LetReturn);
1032+
store.register_early_pass(|| box unused_unit::UnusedUnit);
1033+
store.register_late_pass(|| box returns::Return);
10341034
store.register_early_pass(|| box collapsible_if::CollapsibleIf);
10351035
store.register_early_pass(|| box items_after_statements::ItemsAfterStatements);
10361036
store.register_early_pass(|| box precedence::Precedence);
@@ -1288,7 +1288,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
12881288
LintId::of(&large_enum_variant::LARGE_ENUM_VARIANT),
12891289
LintId::of(&len_zero::LEN_WITHOUT_IS_EMPTY),
12901290
LintId::of(&len_zero::LEN_ZERO),
1291-
LintId::of(&let_and_return::LET_AND_RETURN),
12921291
LintId::of(&let_underscore::LET_UNDERSCORE_LOCK),
12931292
LintId::of(&lifetimes::EXTRA_UNUSED_LIFETIMES),
12941293
LintId::of(&lifetimes::NEEDLESS_LIFETIMES),
@@ -1418,8 +1417,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14181417
LintId::of(&regex::INVALID_REGEX),
14191418
LintId::of(&regex::TRIVIAL_REGEX),
14201419
LintId::of(&repeat_once::REPEAT_ONCE),
1420+
LintId::of(&returns::LET_AND_RETURN),
14211421
LintId::of(&returns::NEEDLESS_RETURN),
1422-
LintId::of(&returns::UNUSED_UNIT),
14231422
LintId::of(&serde_api::SERDE_API_MISUSE),
14241423
LintId::of(&single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS),
14251424
LintId::of(&slow_vector_initialization::SLOW_VECTOR_INITIALIZATION),
@@ -1466,6 +1465,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14661465
LintId::of(&unnecessary_sort_by::UNNECESSARY_SORT_BY),
14671466
LintId::of(&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME),
14681467
LintId::of(&unused_io_amount::UNUSED_IO_AMOUNT),
1468+
LintId::of(&unused_unit::UNUSED_UNIT),
14691469
LintId::of(&unwrap::PANICKING_UNWRAP),
14701470
LintId::of(&unwrap::UNNECESSARY_UNWRAP),
14711471
LintId::of(&useless_conversion::USELESS_CONVERSION),
@@ -1506,7 +1506,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15061506
LintId::of(&inherent_to_string::INHERENT_TO_STRING),
15071507
LintId::of(&len_zero::LEN_WITHOUT_IS_EMPTY),
15081508
LintId::of(&len_zero::LEN_ZERO),
1509-
LintId::of(&let_and_return::LET_AND_RETURN),
15101509
LintId::of(&literal_representation::INCONSISTENT_DIGIT_GROUPING),
15111510
LintId::of(&loops::EMPTY_LOOP),
15121511
LintId::of(&loops::FOR_KV_MAP),
@@ -1561,8 +1560,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15611560
LintId::of(&redundant_field_names::REDUNDANT_FIELD_NAMES),
15621561
LintId::of(&redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES),
15631562
LintId::of(&regex::TRIVIAL_REGEX),
1563+
LintId::of(&returns::LET_AND_RETURN),
15641564
LintId::of(&returns::NEEDLESS_RETURN),
1565-
LintId::of(&returns::UNUSED_UNIT),
15661565
LintId::of(&single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS),
15671566
LintId::of(&strings::STRING_LIT_AS_BYTES),
15681567
LintId::of(&tabs_in_doc_comments::TABS_IN_DOC_COMMENTS),
@@ -1571,6 +1570,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15711570
LintId::of(&types::FN_TO_NUMERIC_CAST),
15721571
LintId::of(&types::FN_TO_NUMERIC_CAST_WITH_TRUNCATION),
15731572
LintId::of(&unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME),
1573+
LintId::of(&unused_unit::UNUSED_UNIT),
15741574
LintId::of(&write::PRINTLN_EMPTY_STRING),
15751575
LintId::of(&write::PRINT_LITERAL),
15761576
LintId::of(&write::PRINT_WITH_NEWLINE),

0 commit comments

Comments
 (0)