Skip to content

Commit 23225e1

Browse files
committed
Consistent lint group table in book and README
The lint table and the restriction group description was improved in rust-lang#10385, but only in the README. Apply the same changes to the book.
1 parent 2202493 commit 23225e1

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

Diff for: book/src/README.md

+19-9
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,27 @@ category.
1818
| `clippy::all` | all lints that are on by default (correctness, suspicious, style, complexity, perf) | **warn/deny** |
1919
| `clippy::correctness` | code that is outright wrong or useless | **deny** |
2020
| `clippy::suspicious` | code that is most likely wrong or useless | **warn** |
21+
| `clippy::style` | code that should be written in a more idiomatic way | **warn** |
2122
| `clippy::complexity` | code that does something simple but in a complex way | **warn** |
2223
| `clippy::perf` | code that can be written to run faster | **warn** |
23-
| `clippy::style` | code that should be written in a more idiomatic way | **warn** |
24-
| `clippy::pedantic` | lints which are rather strict or might have false positives | allow |
24+
| `clippy::pedantic` | lints which are rather strict or have occasional false positives | allow |
25+
| `clippy::restriction` | lints which prevent the use of language and library features[^restrict] | allow |
2526
| `clippy::nursery` | new lints that are still under development | allow |
26-
| `clippy::cargo` | lints for the cargo manifest | allow | | allow |
27+
| `clippy::cargo` | lints for the cargo manifest | allow |
28+
29+
More to come, please [file an issue](https://github.com/rust-lang/rust-clippy/issues) if you have ideas!
30+
31+
The `restriction` category should, *emphatically*, not be enabled as a whole. The contained
32+
lints may lint against perfectly reasonable code, may not have an alternative suggestion,
33+
and may contradict any other lints (including other categories). Lints should be considered
34+
on a case-by-case basis before enabling.
2735

28-
More to come, please [file an
29-
issue](https://github.com/rust-lang/rust-clippy/issues) if you have ideas!
36+
[^restrict]: Some use cases for `restriction` lints include:
37+
- Strict coding styles (e.g. [`clippy::else_if_without_else`]).
38+
- Additional restrictions on CI (e.g. [`clippy::todo`]).
39+
- Preventing panicking in certain functions (e.g. [`clippy::unwrap_used`]).
40+
- Running a lint only on a subset of code (e.g. `#[forbid(clippy::float_arithmetic)]` on a module).
3041

31-
The [lint list](https://rust-lang.github.io/rust-clippy/master/index.html) also
32-
contains "restriction lints", which are for things which are usually not
33-
considered "bad", but may be useful to turn on in specific cases. These should
34-
be used very selectively, if at all.
42+
[`clippy::else_if_without_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#else_if_without_else
43+
[`clippy::todo`]: https://rust-lang.github.io/rust-clippy/master/index.html#todo
44+
[`clippy::unwrap_used`]: https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_used

0 commit comments

Comments
 (0)