Skip to content

Commit 59cf93a

Browse files
committed
Auto merge of #6889 - Y-Nak:refactor-unit-types, r=Y-Nak
Refactor unit types Ref: #6724 r? `@flip1995` Changes: 1. Extract `unit_types` from `types` group. 2. Move lints of `unit_types` to their own modules. Notes: Other lints of `unit_types` is still scattered around the `clippy_lints`, e.g. `result_unit_err` or `option_map_unit_fn`. These should be addressed in another PR. changelog: none
2 parents d7a2311 + 2909b1c commit 59cf93a

File tree

7 files changed

+432
-402
lines changed

7 files changed

+432
-402
lines changed

clippy_lints/src/lib.rs

+10-11
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@ mod types;
350350
mod undropped_manually_drops;
351351
mod unicode;
352352
mod unit_return_expecting_ord;
353+
mod unit_types;
353354
mod unnamed_address;
354355
mod unnecessary_sort_by;
355356
mod unnecessary_wraps;
@@ -960,20 +961,20 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
960961
&types::BOX_VEC,
961962
&types::IMPLICIT_HASHER,
962963
&types::INVALID_UPCAST_COMPARISONS,
963-
&types::LET_UNIT_VALUE,
964964
&types::LINKEDLIST,
965965
&types::OPTION_OPTION,
966966
&types::RC_BUFFER,
967967
&types::REDUNDANT_ALLOCATION,
968968
&types::TYPE_COMPLEXITY,
969-
&types::UNIT_ARG,
970-
&types::UNIT_CMP,
971969
&types::VEC_BOX,
972970
&undropped_manually_drops::UNDROPPED_MANUALLY_DROPS,
973971
&unicode::INVISIBLE_CHARACTERS,
974972
&unicode::NON_ASCII_LITERAL,
975973
&unicode::UNICODE_NOT_NFC,
976974
&unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD,
975+
&unit_types::LET_UNIT_VALUE,
976+
&unit_types::UNIT_ARG,
977+
&unit_types::UNIT_CMP,
977978
&unnamed_address::FN_ADDRESS_COMPARISONS,
978979
&unnamed_address::VTABLE_ADDRESS_COMPARISONS,
979980
&unnecessary_sort_by::UNNECESSARY_SORT_BY,
@@ -1084,8 +1085,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
10841085
store.register_late_pass(|| box map_clone::MapClone);
10851086
store.register_late_pass(|| box map_err_ignore::MapErrIgnore);
10861087
store.register_late_pass(|| box shadow::Shadow);
1087-
store.register_late_pass(|| box types::LetUnitValue);
1088-
store.register_late_pass(|| box types::UnitCmp);
1088+
store.register_late_pass(|| box unit_types::UnitTypes);
10891089
store.register_late_pass(|| box loops::Loops);
10901090
store.register_late_pass(|| box main_recursion::MainRecursion::default());
10911091
store.register_late_pass(|| box lifetimes::Lifetimes);
@@ -1160,7 +1160,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
11601160
store.register_late_pass(|| box useless_conversion::UselessConversion::default());
11611161
store.register_late_pass(|| box types::ImplicitHasher);
11621162
store.register_late_pass(|| box fallible_impl_from::FallibleImplFrom);
1163-
store.register_late_pass(|| box types::UnitArg);
11641163
store.register_late_pass(|| box double_comparison::DoubleComparisons);
11651164
store.register_late_pass(|| box question_mark::QuestionMark);
11661165
store.register_early_pass(|| box suspicious_operation_groupings::SuspiciousOperationGroupings);
@@ -1415,11 +1414,11 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14151414
LintId::of(&trait_bounds::TYPE_REPETITION_IN_BOUNDS),
14161415
LintId::of(&types::IMPLICIT_HASHER),
14171416
LintId::of(&types::INVALID_UPCAST_COMPARISONS),
1418-
LintId::of(&types::LET_UNIT_VALUE),
14191417
LintId::of(&types::LINKEDLIST),
14201418
LintId::of(&types::OPTION_OPTION),
14211419
LintId::of(&unicode::NON_ASCII_LITERAL),
14221420
LintId::of(&unicode::UNICODE_NOT_NFC),
1421+
LintId::of(&unit_types::LET_UNIT_VALUE),
14231422
LintId::of(&unnecessary_wraps::UNNECESSARY_WRAPS),
14241423
LintId::of(&unnested_or_patterns::UNNESTED_OR_PATTERNS),
14251424
LintId::of(&unused_self::UNUSED_SELF),
@@ -1708,12 +1707,12 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
17081707
LintId::of(&types::BOX_VEC),
17091708
LintId::of(&types::REDUNDANT_ALLOCATION),
17101709
LintId::of(&types::TYPE_COMPLEXITY),
1711-
LintId::of(&types::UNIT_ARG),
1712-
LintId::of(&types::UNIT_CMP),
17131710
LintId::of(&types::VEC_BOX),
17141711
LintId::of(&undropped_manually_drops::UNDROPPED_MANUALLY_DROPS),
17151712
LintId::of(&unicode::INVISIBLE_CHARACTERS),
17161713
LintId::of(&unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD),
1714+
LintId::of(&unit_types::UNIT_ARG),
1715+
LintId::of(&unit_types::UNIT_CMP),
17171716
LintId::of(&unnamed_address::FN_ADDRESS_COMPARISONS),
17181717
LintId::of(&unnamed_address::VTABLE_ADDRESS_COMPARISONS),
17191718
LintId::of(&unnecessary_sort_by::UNNECESSARY_SORT_BY),
@@ -1934,8 +1933,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
19341933
LintId::of(&transmute::TRANSMUTE_PTR_TO_REF),
19351934
LintId::of(&types::BORROWED_BOX),
19361935
LintId::of(&types::TYPE_COMPLEXITY),
1937-
LintId::of(&types::UNIT_ARG),
19381936
LintId::of(&types::VEC_BOX),
1937+
LintId::of(&unit_types::UNIT_ARG),
19391938
LintId::of(&unnecessary_sort_by::UNNECESSARY_SORT_BY),
19401939
LintId::of(&unwrap::UNNECESSARY_UNWRAP),
19411940
LintId::of(&useless_conversion::USELESS_CONVERSION),
@@ -2005,10 +2004,10 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
20052004
LintId::of(&transmute::WRONG_TRANSMUTE),
20062005
LintId::of(&transmuting_null::TRANSMUTING_NULL),
20072006
LintId::of(&types::ABSURD_EXTREME_COMPARISONS),
2008-
LintId::of(&types::UNIT_CMP),
20092007
LintId::of(&undropped_manually_drops::UNDROPPED_MANUALLY_DROPS),
20102008
LintId::of(&unicode::INVISIBLE_CHARACTERS),
20112009
LintId::of(&unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD),
2010+
LintId::of(&unit_types::UNIT_CMP),
20122011
LintId::of(&unnamed_address::FN_ADDRESS_COMPARISONS),
20132012
LintId::of(&unnamed_address::VTABLE_ADDRESS_COMPARISONS),
20142013
LintId::of(&unused_io_amount::UNUSED_IO_AMOUNT),

0 commit comments

Comments
 (0)