Skip to content

Commit

Permalink
Auto merge of rust-lang#12649 - flip1995:book-readme-sync, r=xFrednet
Browse files Browse the repository at this point in the history
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.

r? `@xFrednet`

I noticed that I left review comments about this in rust-lang#10385, but never submitted them. So to this day they are listed as "pending" in the GitHub UI.

This is just copy and paste of the current README file on `master`.

changelog: none
  • Loading branch information
bors committed Apr 9, 2024
2 parents 54e8ad8 + 23225e1 commit ccc93f9
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions book/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,27 @@ category.
| `clippy::all` | all lints that are on by default (correctness, suspicious, style, complexity, perf) | **warn/deny** |
| `clippy::correctness` | code that is outright wrong or useless | **deny** |
| `clippy::suspicious` | code that is most likely wrong or useless | **warn** |
| `clippy::style` | code that should be written in a more idiomatic way | **warn** |
| `clippy::complexity` | code that does something simple but in a complex way | **warn** |
| `clippy::perf` | code that can be written to run faster | **warn** |
| `clippy::style` | code that should be written in a more idiomatic way | **warn** |
| `clippy::pedantic` | lints which are rather strict or might have false positives | allow |
| `clippy::pedantic` | lints which are rather strict or have occasional false positives | allow |
| `clippy::restriction` | lints which prevent the use of language and library features[^restrict] | allow |
| `clippy::nursery` | new lints that are still under development | allow |
| `clippy::cargo` | lints for the cargo manifest | allow | | allow |
| `clippy::cargo` | lints for the cargo manifest | allow |

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

The `restriction` category should, *emphatically*, not be enabled as a whole. The contained
lints may lint against perfectly reasonable code, may not have an alternative suggestion,
and may contradict any other lints (including other categories). Lints should be considered
on a case-by-case basis before enabling.

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

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

0 comments on commit ccc93f9

Please sign in to comment.