Skip to content

Commit db52f81

Browse files
committed
Move some lints to suspicious
1 parent 140e735 commit db52f81

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
@@ -1455,7 +1455,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14551455
store.register_group(true, "clippy::style", Some("clippy_style"), vec![
14561456
LintId::of(assertions_on_constants::ASSERTIONS_ON_CONSTANTS),
14571457
LintId::of(assign_ops::ASSIGN_OP_PATTERN),
1458-
LintId::of(attrs::BLANKET_CLIPPY_RESTRICTION_LINTS),
14591458
LintId::of(blacklisted_name::BLACKLISTED_NAME),
14601459
LintId::of(blocks_in_if_conditions::BLOCKS_IN_IF_CONDITIONS),
14611460
LintId::of(bool_assert_comparison::BOOL_ASSERT_COMPARISON),
@@ -1473,9 +1472,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14731472
LintId::of(eq_op::OP_REF),
14741473
LintId::of(eta_reduction::REDUNDANT_CLOSURE),
14751474
LintId::of(float_literal::EXCESSIVE_PRECISION),
1476-
LintId::of(formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING),
1477-
LintId::of(formatting::SUSPICIOUS_ELSE_FORMATTING),
1478-
LintId::of(formatting::SUSPICIOUS_UNARY_OP_FORMATTING),
14791475
LintId::of(from_over_into::FROM_OVER_INTO),
14801476
LintId::of(from_str_radix_10::FROM_STR_RADIX_10),
14811477
LintId::of(functions::DOUBLE_MUST_USE),
@@ -1488,7 +1484,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14881484
LintId::of(len_zero::LEN_ZERO),
14891485
LintId::of(literal_representation::INCONSISTENT_DIGIT_GROUPING),
14901486
LintId::of(literal_representation::UNUSUAL_BYTE_GROUPINGS),
1491-
LintId::of(loops::EMPTY_LOOP),
14921487
LintId::of(loops::FOR_KV_MAP),
14931488
LintId::of(loops::NEEDLESS_RANGE_LOOP),
14941489
LintId::of(loops::SAME_ITEM_PUSH),
@@ -1568,7 +1563,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15681563
]);
15691564

15701565
store.register_group(true, "clippy::complexity", Some("clippy_complexity"), vec![
1571-
LintId::of(assign_ops::MISREFACTORED_ASSIGN_OP),
15721566
LintId::of(attrs::DEPRECATED_CFG_ATTR),
15731567
LintId::of(booleans::NONMINIMAL_BOOL),
15741568
LintId::of(casts::CHAR_LIT_AS_U8),
@@ -1578,7 +1572,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15781572
LintId::of(double_parens::DOUBLE_PARENS),
15791573
LintId::of(duration_subsec::DURATION_SUBSEC),
15801574
LintId::of(eval_order_dependence::DIVERGING_SUB_EXPRESSION),
1581-
LintId::of(eval_order_dependence::EVAL_ORDER_DEPENDENCE),
15821575
LintId::of(explicit_write::EXPLICIT_WRITE),
15831576
LintId::of(format::USELESS_FORMAT),
15841577
LintId::of(functions::TOO_MANY_ARGUMENTS),
@@ -1589,7 +1582,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15891582
LintId::of(lifetimes::NEEDLESS_LIFETIMES),
15901583
LintId::of(loops::EXPLICIT_COUNTER_LOOP),
15911584
LintId::of(loops::MANUAL_FLATTEN),
1592-
LintId::of(loops::MUT_RANGE_BOUND),
15931585
LintId::of(loops::SINGLE_ELEMENT_LOOP),
15941586
LintId::of(loops::WHILE_LET_LOOP),
15951587
LintId::of(manual_strip::MANUAL_STRIP),
@@ -1613,7 +1605,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
16131605
LintId::of(methods::OPTION_FILTER_MAP),
16141606
LintId::of(methods::SEARCH_IS_SOME),
16151607
LintId::of(methods::SKIP_WHILE_NEXT),
1616-
LintId::of(methods::SUSPICIOUS_MAP),
16171608
LintId::of(methods::UNNECESSARY_FILTER_MAP),
16181609
LintId::of(methods::USELESS_ASREF),
16191610
LintId::of(misc::SHORT_CIRCUIT_STATEMENT),
@@ -1682,7 +1673,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
16821673
LintId::of(enum_clike::ENUM_CLIKE_UNPORTABLE_VARIANT),
16831674
LintId::of(eq_op::EQ_OP),
16841675
LintId::of(erasing_op::ERASING_OP),
1685-
LintId::of(float_equality_without_abs::FLOAT_EQUALITY_WITHOUT_ABS),
16861676
LintId::of(formatting::POSSIBLE_MISSING_COMMA),
16871677
LintId::of(functions::NOT_UNSAFE_PTR_ARG_DEREF),
16881678
LintId::of(if_let_mutex::IF_LET_MUTEX),
@@ -1692,7 +1682,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
16921682
LintId::of(inline_fn_without_body::INLINE_FN_WITHOUT_BODY),
16931683
LintId::of(let_underscore::LET_UNDERSCORE_LOCK),
16941684
LintId::of(literal_representation::MISTYPED_LITERAL_SUFFIXES),
1695-
LintId::of(loops::FOR_LOOPS_OVER_FALLIBLES),
16961685
LintId::of(loops::ITER_NEXT_LOOP),
16971686
LintId::of(loops::NEVER_LOOP),
16981687
LintId::of(loops::WHILE_IMMUTABLE_CONDITION),
@@ -1707,7 +1696,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
17071696
LintId::of(misc::CMP_NAN),
17081697
LintId::of(misc::FLOAT_CMP),
17091698
LintId::of(misc::MODULO_ONE),
1710-
LintId::of(mut_key::MUTABLE_KEY_TYPE),
17111699
LintId::of(non_octal_unix_permissions::NON_OCTAL_UNIX_PERMISSIONS),
17121700
LintId::of(open_options::NONSENSICAL_OPEN_OPTIONS),
17131701
LintId::of(option_env_unwrap::OPTION_ENV_UNWRAP),
@@ -1718,8 +1706,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
17181706
LintId::of(self_assignment::SELF_ASSIGNMENT),
17191707
LintId::of(serde_api::SERDE_API_MISUSE),
17201708
LintId::of(size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT),
1721-
LintId::of(suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL),
1722-
LintId::of(suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL),
17231709
LintId::of(swap::ALMOST_SWAPPED),
17241710
LintId::of(to_string_in_display::TO_STRING_IN_DISPLAY),
17251711
LintId::of(transmute::UNSOUND_COLLECTION_TRANSMUTE),
@@ -1760,6 +1746,23 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
17601746
LintId::of(vec_init_then_push::VEC_INIT_THEN_PUSH),
17611747
]);
17621748

1749+
store.register_group(true, "clippy::suspicious", None, vec![
1750+
LintId::of(assign_ops::MISREFACTORED_ASSIGN_OP),
1751+
LintId::of(attrs::BLANKET_CLIPPY_RESTRICTION_LINTS),
1752+
LintId::of(eval_order_dependence::EVAL_ORDER_DEPENDENCE),
1753+
LintId::of(float_equality_without_abs::FLOAT_EQUALITY_WITHOUT_ABS),
1754+
LintId::of(formatting::SUSPICIOUS_ASSIGNMENT_FORMATTING),
1755+
LintId::of(formatting::SUSPICIOUS_ELSE_FORMATTING),
1756+
LintId::of(formatting::SUSPICIOUS_UNARY_OP_FORMATTING),
1757+
LintId::of(loops::EMPTY_LOOP),
1758+
LintId::of(loops::FOR_LOOPS_OVER_FALLIBLES),
1759+
LintId::of(loops::MUT_RANGE_BOUND),
1760+
LintId::of(methods::SUSPICIOUS_MAP),
1761+
LintId::of(mut_key::MUTABLE_KEY_TYPE),
1762+
LintId::of(suspicious_trait_impl::SUSPICIOUS_ARITHMETIC_IMPL),
1763+
LintId::of(suspicious_trait_impl::SUSPICIOUS_OP_ASSIGN_IMPL),
1764+
]);
1765+
17631766
store.register_group(true, "clippy::cargo", Some("clippy_cargo"), vec![
17641767
LintId::of(cargo_common_metadata::CARGO_COMMON_METADATA),
17651768
LintId::of(multiple_crate_versions::MULTIPLE_CRATE_VERSIONS),

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)