Skip to content

Commit f02632c

Browse files
committed
Move some lints to suspicious
1 parent 7e21db5 commit f02632c

12 files changed

+33
-30
lines changed

clippy_lints/src/assign_ops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ declare_clippy_lint! {
5555
/// a += a + b;
5656
/// ```
5757
pub MISREFACTORED_ASSIGN_OP,
58-
complexity,
58+
suspicious,
5959
"having a variable on both sides of an assign op"
6060
}
6161

clippy_lints/src/attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ declare_clippy_lint! {
173173
/// #![deny(clippy::as_conversions)]
174174
/// ```
175175
pub BLANKET_CLIPPY_RESTRICTION_LINTS,
176-
style,
176+
suspicious,
177177
"enabling the complete restriction group"
178178
}
179179

clippy_lints/src/eval_order_dependence.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ declare_clippy_lint! {
3838
/// let a = tmp + x;
3939
/// ```
4040
pub EVAL_ORDER_DEPENDENCE,
41-
complexity,
41+
suspicious,
4242
"whether a variable read occurs before a write depends on sub-expression evaluation order"
4343
}
4444

clippy_lints/src/float_equality_without_abs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ declare_clippy_lint! {
3636
/// }
3737
/// ```
3838
pub FLOAT_EQUALITY_WITHOUT_ABS,
39-
correctness,
39+
suspicious,
4040
"float equality check without `.abs()`"
4141
}
4242

clippy_lints/src/formatting.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ declare_clippy_lint! {
2222
/// a =- 42; // confusing, should it be `a -= 42` or `a = -42`?
2323
/// ```
2424
pub SUSPICIOUS_ASSIGNMENT_FORMATTING,
25-
style,
25+
suspicious,
2626
"suspicious formatting of `*=`, `-=` or `!=`"
2727
}
2828

@@ -44,7 +44,7 @@ declare_clippy_lint! {
4444
/// }
4545
/// ```
4646
pub SUSPICIOUS_UNARY_OP_FORMATTING,
47-
style,
47+
suspicious,
4848
"suspicious formatting of unary `-` or `!` on the RHS of a BinOp"
4949
}
5050

@@ -80,7 +80,7 @@ declare_clippy_lint! {
8080
/// }
8181
/// ```
8282
pub SUSPICIOUS_ELSE_FORMATTING,
83-
style,
83+
suspicious,
8484
"suspicious formatting of `else`"
8585
}
8686

clippy_lints/src/lib.rs

+17-14
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14611461
store.register_group(true, "clippy::style", Some("clippy_style"), vec![
14621462
LintId::of(assertions_on_constants::ASSERTIONS_ON_CONSTANTS),
14631463
LintId::of(assign_ops::ASSIGN_OP_PATTERN),
1464-
LintId::of(attrs::BLANKET_CLIPPY_RESTRICTION_LINTS),
14651464
LintId::of(blacklisted_name::BLACKLISTED_NAME),
14661465
LintId::of(blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS),
14671466
LintId::of(bool_assert_comparison::BOOL_ASSERT_COMPARISON),
@@ -1479,9 +1478,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14791478
LintId::of(eq_op::OP_REF),
14801479
LintId::of(eta_reduction::REDUNDANT_CLOSURE),
14811480
LintId::of(float_literal::EXCESSIVE_PRECISION),
1482-
LintId::of(formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING),
1483-
LintId::of(formatting::SUSPICIOUS_ELSE_FORMATTING),
1484-
LintId::of(formatting::SUSPICIOUS_UNARY_OP_FORMATTING),
14851481
LintId::of(from_over_into::FROM_OVER_INTO),
14861482
LintId::of(from_str_radix_10::FROM_STR_RADIX_10),
14871483
LintId::of(functions::DOUBLE_MUST_USE),
@@ -1494,7 +1490,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14941490
LintId::of(len_zero::LEN_ZERO),
14951491
LintId::of(literal_representation::INCONSISTENT_DIGIT_GROUPING),
14961492
LintId::of(literal_representation::UNUSUAL_BYTE_GROUPINGS),
1497-
LintId::of(loops::EMPTY_LOOP),
14981493
LintId::of(loops::FOR_KV_MAP),
14991494
LintId::of(loops::NEEDLESS_RANGE_LOOP),
15001495
LintId::of(loops::SAME_ITEM_PUSH),
@@ -1574,7 +1569,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15741569
]);
15751570

15761571
store.register_group(true, "clippy::complexity", Some("clippy_complexity"), vec![
1577-
LintId::of(assign_ops::MISREFACTORED_ASSIGN_OP),
15781572
LintId::of(attrs::DEPRECATED_CFG_ATTR),
15791573
LintId::of(booleans::NONMINIMAL_BOOL),
15801574
LintId::of(casts::CHAR_LIT_AS_U8),
@@ -1584,7 +1578,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15841578
LintId::of(double_parens::DOUBLE_PARENS),
15851579
LintId::of(duration_subsec::DURATION_SUBSEC),
15861580
LintId::of(eval_order_dependence::DIVERGING_SUB_EXPRESSION),
1587-
LintId::of(eval_order_dependence::EVAL_ORDER_DEPENDENCE),
15881581
LintId::of(explicit_write::EXPLICIT_WRITE),
15891582
LintId::of(format::USELESS_FORMAT),
15901583
LintId::of(functions::TOO_MANY_ARGUMENTS),
@@ -1595,7 +1588,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15951588
LintId::of(lifetimes::NEEDLESS_LIFETIMES),
15961589
LintId::of(loops::EXPLICIT_COUNTER_LOOP),
15971590
LintId::of(loops::MANUAL_FLATTEN),
1598-
LintId::of(loops::MUT_RANGE_BOUND),
15991591
LintId::of(loops::SINGLE_ELEMENT_LOOP),
16001592
LintId::of(loops::WHILE_LET_LOOP),
16011593
LintId::of(manual_strip::MANUAL_STRIP),
@@ -1619,7 +1611,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
16191611
LintId::of(methods::OPTION_FILTER_MAP),
16201612
LintId::of(methods::SEARCH_IS_SOME),
16211613
LintId::of(methods::SKIP_WHILE_NEXT),
1622-
LintId::of(methods::SUSPICIOUS_MAP),
16231614
LintId::of(methods::UNNECESSARY_FILTER_MAP),
16241615
LintId::of(methods::USELESS_ASREF),
16251616
LintId::of(misc::SHORT_CIRCUIT_STATEMENT),
@@ -1688,7 +1679,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
16881679
LintId::of(enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT),
16891680
LintId::of(eq_op::EQ_OP),
16901681
LintId::of(erasing_op::ERASING_OP),
1691-
LintId::of(float_equality_without_abs::FLOAT_EQUALITY_WITHOUT_ABS),
16921682
LintId::of(formatting::POSSIBLE_MISSING_COMMA),
16931683
LintId::of(functions::NOT_UNSAFE_PTR_ARG_DEREF),
16941684
LintId::of(if_let_mutex::IF_LET_MUTEX),
@@ -1698,7 +1688,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
16981688
LintId::of(inline_fn_without_body::INLINE_FN_WITHOUT_BODY),
16991689
LintId::of(let_underscore::LET_UNDERSCORE_LOCK),
17001690
LintId::of(literal_representation::MISTYPED_LITERAL_SUFFIXES),
1701-
LintId::of(loops::FOR_LOOPS_OVER_FALLIBLES),
17021691
LintId::of(loops::ITER_NEXT_LOOP),
17031692
LintId::of(loops::NEVER_LOOP),
17041693
LintId::of(loops::WHILE_IMMUTABLE_CONDITION),
@@ -1713,7 +1702,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
17131702
LintId::of(misc::CMP_NAN),
17141703
LintId::of(misc::FLOAT_CMP),
17151704
LintId::of(misc::MODULO_ONE),
1716-
LintId::of(mut_key::MUTABLE_KEY_TYPE),
17171705
LintId::of(non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS),
17181706
LintId::of(open_options::NONSENSICAL_OPEN_OPTIONS),
17191707
LintId::of(option_env_unwrap::OPTION_ENV_UNWRAP),
@@ -1724,8 +1712,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
17241712
LintId::of(self_assignment::SELF_ASSIGNMENT),
17251713
LintId::of(serde_api::SERDE_API_MISUSE),
17261714
LintId::of(size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT),
1727-
LintId::of(suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL),
1728-
LintId::of(suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL),
17291715
LintId::of(swap::ALMOST_SWAPPED),
17301716
LintId::of(to_string_in_display::TO_STRING_IN_DISPLAY),
17311717
LintId::of(transmute::UNSOUND_COLLECTION_TRANSMUTE),
@@ -1742,6 +1728,23 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
17421728
LintId::of(vec_resize_to_zero::VEC_RESIZE_TO_ZERO),
17431729
]);
17441730

1731+
store.register_group(true, "clippy::suspicious", None, vec![
1732+
LintId::of(assign_ops::MISREFACTORED_ASSIGN_OP),
1733+
LintId::of(attrs::BLANKET_CLIPPY_RESTRICTION_LINTS),
1734+
LintId::of(eval_order_dependence::EVAL_ORDER_DEPENDENCE),
1735+
LintId::of(float_equality_without_abs::FLOAT_EQUALITY_WITHOUT_ABS),
1736+
LintId::of(formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING),
1737+
LintId::of(formatting::SUSPICIOUS_ELSE_FORMATTING),
1738+
LintId::of(formatting::SUSPICIOUS_UNARY_OP_FORMATTING),
1739+
LintId::of(loops::EMPTY_LOOP),
1740+
LintId::of(loops::FOR_LOOPS_OVER_FALLIBLES),
1741+
LintId::of(loops::MUT_RANGE_BOUND),
1742+
LintId::of(methods::SUSPICIOUS_MAP),
1743+
LintId::of(mut_key::MUTABLE_KEY_TYPE),
1744+
LintId::of(suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL),
1745+
LintId::of(suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL),
1746+
]);
1747+
17451748
store.register_group(true, "clippy::perf", Some("clippy_perf"), vec![
17461749
LintId::of(entry::MAP_ENTRY),
17471750
LintId::of(escape::BOXED_LOCAL),

clippy_lints/src/loops/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ declare_clippy_lint! {
199199
/// }
200200
/// ```
201201
pub FOR_LOOPS_OVER_FALLIBLES,
202-
correctness,
202+
suspicious,
203203
"for-looping over an `Option` or a `Result`, which is more clearly expressed as an `if let`"
204204
}
205205

@@ -313,7 +313,7 @@ declare_clippy_lint! {
313313
/// loop {}
314314
/// ```
315315
pub EMPTY_LOOP,
316-
style,
316+
suspicious,
317317
"empty `loop {}`, which should block or sleep"
318318
}
319319

@@ -401,7 +401,7 @@ declare_clippy_lint! {
401401
/// }
402402
/// ```
403403
pub MUT_RANGE_BOUND,
404-
complexity,
404+
suspicious,
405405
"for loop over a range where one of the bounds is a mutable variable"
406406
}
407407

clippy_lints/src/methods/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ declare_clippy_lint! {
12481248
/// let _ = (0..3).map(|x| x + 2).count();
12491249
/// ```
12501250
pub SUSPICIOUS_MAP,
1251-
complexity,
1251+
suspicious,
12521252
"suspicious usage of map"
12531253
}
12541254

clippy_lints/src/mut_key.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ declare_clippy_lint! {
5050
/// }
5151
/// ```
5252
pub MUTABLE_KEY_TYPE,
53-
correctness,
53+
suspicious,
5454
"Check for mutable `Map`/`Set` key type"
5555
}
5656

clippy_lints/src/suspicious_trait_impl.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ declare_clippy_lint! {
2626
/// }
2727
/// ```
2828
pub SUSPICIOUS_ARITHMETIC_IMPL,
29-
correctness,
29+
suspicious,
3030
"suspicious use of operators in impl of arithmetic trait"
3131
}
3232

@@ -47,7 +47,7 @@ declare_clippy_lint! {
4747
/// }
4848
/// ```
4949
pub SUSPICIOUS_OP_ASSIGN_IMPL,
50-
correctness,
50+
suspicious,
5151
"suspicious use of operators in impl of OpAssign trait"
5252
}
5353

tests/ui/mut_key.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: mutable key type
44
LL | fn should_not_take_this_arg(m: &mut HashMap<Key, usize>, _n: usize) -> HashSet<Key> {
55
| ^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= note: `#[deny(clippy::mutable_key_type)]` on by default
7+
= note: `-D clippy::mutable-key-type` implied by `-D warnings`
88

99
error: mutable key type
1010
--> $DIR/mut_key.rs:27:72

tests/ui/suspicious_arithmetic_impl.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ error: suspicious use of binary operator in `AddAssign` impl
1212
LL | *self = *self - other;
1313
| ^
1414
|
15-
= note: `#[deny(clippy::suspicious_op_assign_impl)]` on by default
15+
= note: `-D clippy::suspicious-op-assign-impl` implied by `-D warnings`
1616

1717
error: suspicious use of binary operator in `MulAssign` impl
1818
--> $DIR/suspicious_arithmetic_impl.rs:32:16

0 commit comments

Comments
 (0)