Skip to content

Commit 140e735

Browse files
committed
Add suspicious group
1 parent a36a7c8 commit 140e735

File tree

6 files changed

+17
-5
lines changed

6 files changed

+17
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ You can choose how much Clippy is supposed to ~~annoy~~ help you by changing the
1717
| `clippy::style` | code that should be written in a more idiomatic way | **warn** |
1818
| `clippy::complexity` | code that does something simple but in a complex way | **warn** |
1919
| `clippy::perf` | code that can be written to run faster | **warn** |
20+
| `clippy::suspicious` | code that seems very likely to be incorrect | **warn** |
2021
| `clippy::pedantic` | lints which are rather strict or might have false positives | allow |
2122
| `clippy::nursery` | new lints that are still under development | allow |
2223
| `clippy::cargo` | lints for the cargo manifest | allow |

clippy_dev/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
125125
"correctness",
126126
"complexity",
127127
"perf",
128+
"suspicious",
128129
"pedantic",
129130
"restriction",
130131
"cargo",

clippy_dev/src/update_lints.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ pub fn run(update_mode: UpdateMode) {
9292
|| {
9393
// clippy::all should only include the following lint groups:
9494
let all_group_lints = usable_lints.iter().filter(|l| {
95-
l.group == "correctness" || l.group == "style" || l.group == "complexity" || l.group == "perf"
95+
matches!(
96+
&*l.group,
97+
"correctness" | "style" | "complexity" | "perf" | "suspicious"
98+
)
9699
});
97100

98101
gen_lint_group_list(all_group_lints)

clippy_lints/src/lib.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ use rustc_session::Session;
6060
/// 4. The `description` that contains a short explanation on what's wrong with code where the
6161
/// lint is triggered.
6262
///
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`, `complexity`, `perf` and `suspicious` 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.
6666
///
6767
/// # Example
6868
///
@@ -116,6 +116,11 @@ macro_rules! declare_clippy_lint {
116116
$(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
117117
}
118118
};
119+
{ $(#[$attr:meta])* pub $name:tt, suspicious, $description:tt } => {
120+
declare_tool_lint! {
121+
$(#[$attr])* pub clippy::$name, Warn, $description, report_in_external_macro: true
122+
}
123+
};
119124
{ $(#[$attr:meta])* pub $name:tt, pedantic, $description:tt } => {
120125
declare_tool_lint! {
121126
$(#[$attr])* pub clippy::$name, Allow, $description, report_in_external_macro: true

clippy_lints/src/utils/internal_lints/metadata_collector.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,14 @@ const DEPRECATED_LINT_GROUP_STR: &str = "deprecated";
4646
const DEPRECATED_LINT_LEVEL: &str = "none";
4747
/// This array holds Clippy's lint groups with their corresponding default lint level. The
4848
/// lint level for deprecated lints is set in `DEPRECATED_LINT_LEVEL`.
49-
const DEFAULT_LINT_LEVELS: [(&str, &str); 8] = [
49+
const DEFAULT_LINT_LEVELS: &[(&str, &str)] = &[
5050
("correctness", "deny"),
5151
("restriction", "allow"),
5252
("style", "warn"),
5353
("pedantic", "allow"),
5454
("complexity", "warn"),
5555
("perf", "warn"),
56+
("suspicious", "warn"),
5657
("cargo", "allow"),
5758
("nursery", "allow"),
5859
];

util/lintlib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"style": 'Warn',
2323
"complexity": 'Warn',
2424
"perf": 'Warn',
25+
"suspicious": 'Warn',
2526
"restriction": 'Allow',
2627
"pedantic": 'Allow',
2728
"nursery": 'Allow',

0 commit comments

Comments
 (0)