Skip to content

Commit e405c68

Browse files
committed
Auto merge of #7350 - camsteffen:suspicious, r=flip1995
Add suspicious group changelog: Introduce `clippy::suspicious` 🤔 group and move several lints into the group Closes #6366. CC #6626. A number of lints are moved from each of `correctness`, `style` and `complexity` groups. Notably I didn't move `suspicious_splitn` since I think that is a `correctness` lint despite the name. Lints moved to `clippy::suspicious`: * `blanket_clippy_restriction_lints` (was `clippy::style`) * `empty_loop` (was `clippy::style`) * `eval_order_dependence` (was `clippy::complexity`) * `float_equality_without_abs` (was `clippy::correctness`) * `for_loops_over_fallibles` (was `clippy::correctness`) * `misrefactored_assign_op` (was `clippy::complexity`) * `mut_range_bound` (was `clippy::complexity`) * `mutable_key_type` (was `clippy::correctness`) * `suspicious_arithmetic_impl` (was `clippy::correctness`) * `suspicious_assignment_formatting` (was `clippy::style`) * `suspicious_else_formatting` (was `clippy::style`) * `suspicious_map` (was `clippy::complexity`) * `suspicious_op_assign_impl` (was `clippy::correctness`) * `suspicious_unary_op_formatting` (was `clippy::style`)
2 parents 8d427b6 + 5b5f0ea commit e405c68

File tree

19 files changed

+62
-46
lines changed

19 files changed

+62
-46
lines changed

.github/workflows/remark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
uses: actions/setup-node@v1.4.4
2323

2424
- name: Install remark
25-
run: npm install remark-cli remark-lint remark-lint-maximum-line-length remark-preset-lint-recommended
25+
run: npm install remark-cli remark-lint remark-lint-maximum-line-length remark-preset-lint-recommended remark-gfm
2626

2727
# Run
2828
- name: Check *.md files

.remarkrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"plugins": [
33
"remark-preset-lint-recommended",
4+
"remark-gfm",
45
["remark-lint-list-item-indent", false],
56
["remark-lint-no-literal-urls", false],
67
["remark-lint-no-shortcut-reference-link", false],

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ A collection of lints to catch common mistakes and improve your [Rust](https://g
1010
Lints are divided into categories, each with a default [lint level](https://doc.rust-lang.org/rustc/lints/levels.html).
1111
You can choose how much Clippy is supposed to ~~annoy~~ help you by changing the lint level by category.
1212

13-
| Category | Description | Default level |
14-
| --------------------- | ----------------------------------------------------------------------- | ------------- |
15-
| `clippy::all` | all lints that are on by default (correctness, style, complexity, perf) | **warn/deny** |
16-
| `clippy::correctness` | code that is outright wrong or very useless | **deny** |
17-
| `clippy::style` | code that should be written in a more idiomatic way | **warn** |
18-
| `clippy::complexity` | code that does something simple but in a complex way | **warn** |
19-
| `clippy::perf` | code that can be written to run faster | **warn** |
20-
| `clippy::pedantic` | lints which are rather strict or might have false positives | allow |
21-
| `clippy::nursery` | new lints that are still under development | allow |
22-
| `clippy::cargo` | lints for the cargo manifest | allow |
13+
| Category | Description | Default level |
14+
| --------------------- | ----------------------------------------------------------------------------------- | ------------- |
15+
| `clippy::all` | all lints that are on by default (correctness, suspicious, style, complexity, perf) | **warn/deny** |
16+
| `clippy::correctness` | code that is outright wrong or useless | **deny** |
17+
| `clippy::suspicious` | code that is most likely wrong or useless | **warn** |
18+
| `clippy::style` | code that should be written in a more idiomatic way | **warn** |
19+
| `clippy::complexity` | code that does something simple but in a complex way | **warn** |
20+
| `clippy::perf` | code that can be written to run faster | **warn** |
21+
| `clippy::pedantic` | lints which are rather strict or might have false positives | allow |
22+
| `clippy::nursery` | new lints that are still under development | allow |
23+
| `clippy::cargo` | lints for the cargo manifest | allow |
2324

2425
More to come, please [file an issue](https://github.com/rust-lang/rust-clippy/issues) if you have ideas!
2526

clippy_dev/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ fn get_clap_config<'a>() -> ArgMatches<'a> {
137137
.possible_values(&[
138138
"style",
139139
"correctness",
140+
"suspicious",
140141
"complexity",
141142
"perf",
142143
"pedantic",

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" | "suspicious" | "style" | "complexity" | "perf"
98+
)
9699
});
97100

98101
gen_lint_group_list(all_group_lints)

clippy_lints/src/assign_ops.rs

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
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

0 commit comments

Comments
 (0)