Document conflicting lints

This commit is contained in:
Caio 2023-10-13 10:09:58 -03:00
parent c40359d97a
commit d1796054fe

View File

@ -30,6 +30,7 @@ because that's clearly a non-descriptive name.
- [Documentation](#documentation) - [Documentation](#documentation)
- [Running rustfmt](#running-rustfmt) - [Running rustfmt](#running-rustfmt)
- [Debugging](#debugging) - [Debugging](#debugging)
- [Conflicting lints](#conflicting-lints)
- [PR Checklist](#pr-checklist) - [PR Checklist](#pr-checklist)
- [Adding configuration to a lint](#adding-configuration-to-a-lint) - [Adding configuration to a lint](#adding-configuration-to-a-lint)
- [Cheat Sheet](#cheat-sheet) - [Cheat Sheet](#cheat-sheet)
@ -612,6 +613,20 @@ output in the `stdout` part.
[`dbg!`]: https://doc.rust-lang.org/std/macro.dbg.html [`dbg!`]: https://doc.rust-lang.org/std/macro.dbg.html
## Conflicting lints
There are several lints that deal with the same pattern but suggest different approaches. In other words, some lints
may suggest modifications that go in the opposite direction to what some other lints already propose for the same
code, creating conflicting diagnostics.
When you are creating a lint that ends up in this scenario, the following tips should be encouraged to guide
classification:
* The only case where they should be in the same category is if that category is `restriction`. For example,
`semicolon_inside_block` and `semicolon_outside_block`.
* For all the other cases, they should be in different categories with different levels of allowance. For example,
`implicit_return` (restriction, allow) and `needless_return` (style, warn).
## PR Checklist ## PR Checklist
Before submitting your PR make sure you followed all the basic requirements: Before submitting your PR make sure you followed all the basic requirements: