@@ -60,9 +60,9 @@ use rustc_session::Session;
60
60
/// 4. The `description` that contains a short explanation on what's wrong with code where the
61
61
/// lint is triggered.
62
62
///
63
- /// Currently the categories `style`, `correctness`, `complexity` and `perf` are enabled by default.
64
- /// As said in the README.md of this repository, if the lint level mapping changes, please update
65
- /// README.md.
63
+ /// Currently the categories `style`, `correctness`, `suspicious`, ` complexity` and `perf` are
64
+ /// enabled by default. As said in the README.md of this repository, if the lint level mapping
65
+ /// changes, please update README.md.
66
66
///
67
67
/// # Example
68
68
///
@@ -106,6 +106,11 @@ macro_rules! declare_clippy_lint {
106
106
$( #[ $attr] ) * pub clippy:: $name, Deny , $description, report_in_external_macro: true
107
107
}
108
108
} ;
109
+ { $( #[ $attr: meta] ) * pub $name: tt, suspicious, $description: tt } => {
110
+ declare_tool_lint! {
111
+ $( #[ $attr] ) * pub clippy:: $name, Warn , $description, report_in_external_macro: true
112
+ }
113
+ } ;
109
114
{ $( #[ $attr: meta] ) * pub $name: tt, complexity, $description: tt } => {
110
115
declare_tool_lint! {
111
116
$( #[ $attr] ) * pub clippy:: $name, Warn , $description, report_in_external_macro: true
@@ -1456,7 +1461,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
1456
1461
store. register_group ( true , "clippy::style" , Some ( "clippy_style" ) , vec ! [
1457
1462
LintId :: of( assertions_on_constants:: ASSERTIONS_ON_CONSTANTS ) ,
1458
1463
LintId :: of( assign_ops:: ASSIGN_OP_PATTERN ) ,
1459
- LintId :: of( attrs:: BLANKET_CLIPPY_RESTRICTION_LINTS ) ,
1460
1464
LintId :: of( blacklisted_name:: BLACKLISTED_NAME ) ,
1461
1465
LintId :: of( blocks_in_if_conditions:: BLOCKS_IN_IF_CONDITIONS ) ,
1462
1466
LintId :: of( bool_assert_comparison:: BOOL_ASSERT_COMPARISON ) ,
@@ -1474,9 +1478,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
1474
1478
LintId :: of( eq_op:: OP_REF ) ,
1475
1479
LintId :: of( eta_reduction:: REDUNDANT_CLOSURE ) ,
1476
1480
LintId :: of( float_literal:: EXCESSIVE_PRECISION ) ,
1477
- LintId :: of( formatting:: SUSPICIOUS_ASSIGNMENT_FORMATTING ) ,
1478
- LintId :: of( formatting:: SUSPICIOUS_ELSE_FORMATTING ) ,
1479
- LintId :: of( formatting:: SUSPICIOUS_UNARY_OP_FORMATTING ) ,
1480
1481
LintId :: of( from_over_into:: FROM_OVER_INTO ) ,
1481
1482
LintId :: of( from_str_radix_10:: FROM_STR_RADIX_10 ) ,
1482
1483
LintId :: of( functions:: DOUBLE_MUST_USE ) ,
@@ -1489,7 +1490,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
1489
1490
LintId :: of( len_zero:: LEN_ZERO ) ,
1490
1491
LintId :: of( literal_representation:: INCONSISTENT_DIGIT_GROUPING ) ,
1491
1492
LintId :: of( literal_representation:: UNUSUAL_BYTE_GROUPINGS ) ,
1492
- LintId :: of( loops:: EMPTY_LOOP ) ,
1493
1493
LintId :: of( loops:: FOR_KV_MAP ) ,
1494
1494
LintId :: of( loops:: NEEDLESS_RANGE_LOOP ) ,
1495
1495
LintId :: of( loops:: SAME_ITEM_PUSH ) ,
@@ -1569,7 +1569,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
1569
1569
] ) ;
1570
1570
1571
1571
store. register_group ( true , "clippy::complexity" , Some ( "clippy_complexity" ) , vec ! [
1572
- LintId :: of( assign_ops:: MISREFACTORED_ASSIGN_OP ) ,
1573
1572
LintId :: of( attrs:: DEPRECATED_CFG_ATTR ) ,
1574
1573
LintId :: of( booleans:: NONMINIMAL_BOOL ) ,
1575
1574
LintId :: of( casts:: CHAR_LIT_AS_U8 ) ,
@@ -1579,7 +1578,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
1579
1578
LintId :: of( double_parens:: DOUBLE_PARENS ) ,
1580
1579
LintId :: of( duration_subsec:: DURATION_SUBSEC ) ,
1581
1580
LintId :: of( eval_order_dependence:: DIVERGING_SUB_EXPRESSION ) ,
1582
- LintId :: of( eval_order_dependence:: EVAL_ORDER_DEPENDENCE ) ,
1583
1581
LintId :: of( explicit_write:: EXPLICIT_WRITE ) ,
1584
1582
LintId :: of( format:: USELESS_FORMAT ) ,
1585
1583
LintId :: of( functions:: TOO_MANY_ARGUMENTS ) ,
@@ -1590,7 +1588,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
1590
1588
LintId :: of( lifetimes:: NEEDLESS_LIFETIMES ) ,
1591
1589
LintId :: of( loops:: EXPLICIT_COUNTER_LOOP ) ,
1592
1590
LintId :: of( loops:: MANUAL_FLATTEN ) ,
1593
- LintId :: of( loops:: MUT_RANGE_BOUND ) ,
1594
1591
LintId :: of( loops:: SINGLE_ELEMENT_LOOP ) ,
1595
1592
LintId :: of( loops:: WHILE_LET_LOOP ) ,
1596
1593
LintId :: of( manual_strip:: MANUAL_STRIP ) ,
@@ -1614,7 +1611,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
1614
1611
LintId :: of( methods:: OPTION_FILTER_MAP ) ,
1615
1612
LintId :: of( methods:: SEARCH_IS_SOME ) ,
1616
1613
LintId :: of( methods:: SKIP_WHILE_NEXT ) ,
1617
- LintId :: of( methods:: SUSPICIOUS_MAP ) ,
1618
1614
LintId :: of( methods:: UNNECESSARY_FILTER_MAP ) ,
1619
1615
LintId :: of( methods:: USELESS_ASREF ) ,
1620
1616
LintId :: of( misc:: SHORT_CIRCUIT_STATEMENT ) ,
@@ -1683,7 +1679,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
1683
1679
LintId :: of( enum_clike:: ENUM_CLIKE_UNPORTABLE_VARIANT ) ,
1684
1680
LintId :: of( eq_op:: EQ_OP ) ,
1685
1681
LintId :: of( erasing_op:: ERASING_OP ) ,
1686
- LintId :: of( float_equality_without_abs:: FLOAT_EQUALITY_WITHOUT_ABS ) ,
1687
1682
LintId :: of( formatting:: POSSIBLE_MISSING_COMMA ) ,
1688
1683
LintId :: of( functions:: NOT_UNSAFE_PTR_ARG_DEREF ) ,
1689
1684
LintId :: of( if_let_mutex:: IF_LET_MUTEX ) ,
@@ -1693,7 +1688,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
1693
1688
LintId :: of( inline_fn_without_body:: INLINE_FN_WITHOUT_BODY ) ,
1694
1689
LintId :: of( let_underscore:: LET_UNDERSCORE_LOCK ) ,
1695
1690
LintId :: of( literal_representation:: MISTYPED_LITERAL_SUFFIXES ) ,
1696
- LintId :: of( loops:: FOR_LOOPS_OVER_FALLIBLES ) ,
1697
1691
LintId :: of( loops:: ITER_NEXT_LOOP ) ,
1698
1692
LintId :: of( loops:: NEVER_LOOP ) ,
1699
1693
LintId :: of( loops:: WHILE_IMMUTABLE_CONDITION ) ,
@@ -1708,7 +1702,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
1708
1702
LintId :: of( misc:: CMP_NAN ) ,
1709
1703
LintId :: of( misc:: FLOAT_CMP ) ,
1710
1704
LintId :: of( misc:: MODULO_ONE ) ,
1711
- LintId :: of( mut_key:: MUTABLE_KEY_TYPE ) ,
1712
1705
LintId :: of( non_octal_unix_permissions:: NON_OCTAL_UNIX_PERMISSIONS ) ,
1713
1706
LintId :: of( open_options:: NONSENSICAL_OPEN_OPTIONS ) ,
1714
1707
LintId :: of( option_env_unwrap:: OPTION_ENV_UNWRAP ) ,
@@ -1719,8 +1712,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
1719
1712
LintId :: of( self_assignment:: SELF_ASSIGNMENT ) ,
1720
1713
LintId :: of( serde_api:: SERDE_API_MISUSE ) ,
1721
1714
LintId :: of( size_of_in_element_count:: SIZE_OF_IN_ELEMENT_COUNT ) ,
1722
- LintId :: of( suspicious_trait_impl:: SUSPICIOUS_ARITHMETIC_IMPL ) ,
1723
- LintId :: of( suspicious_trait_impl:: SUSPICIOUS_OP_ASSIGN_IMPL ) ,
1724
1715
LintId :: of( swap:: ALMOST_SWAPPED ) ,
1725
1716
LintId :: of( to_string_in_display:: TO_STRING_IN_DISPLAY ) ,
1726
1717
LintId :: of( transmute:: UNSOUND_COLLECTION_TRANSMUTE ) ,
@@ -1737,6 +1728,23 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
1737
1728
LintId :: of( vec_resize_to_zero:: VEC_RESIZE_TO_ZERO ) ,
1738
1729
] ) ;
1739
1730
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
+
1740
1748
store. register_group ( true , "clippy::perf" , Some ( "clippy_perf" ) , vec ! [
1741
1749
LintId :: of( entry:: MAP_ENTRY ) ,
1742
1750
LintId :: of( escape:: BOXED_LOCAL ) ,
0 commit comments