Description
Currently, the lint rules grouped as "methods" reside in clippy_lints/src/methods
as there are a number of rules belonging to the "methods" group.
However, although the other groups such as "loops", "types", "transmute" and "misc" also have many relavent rules, they reside not in clippy_lints/src/<group_name>
but in clippy_lints/src
.
It would be great to have these groups located under <group_name>
directory just like "methods". So I open this issue to do this refactoring and to keep track of it.
-
loops (done by @nahuakang & @Y-Nak Refactor: organize loops file into loops module (Delegated) #6824) -
types (done by @Y-Nak Tracking Issue for refactoringtypes.rs
#6724) -
transmute (done by @magurotuna Refactor: arrange transmute lints #6716) -
functions (done by @Y-Nak Organize functions into functions module #6990) -
methods (also needs to be refactored because currently most of rule implementation are included inclippy_lints/src/methods/mod.rs
. Would be good if the implementations went toclippy_lints/src/methods/<lint_name>.rs
.) (done by @TaKO8Ki [Tracking Issue] Refactor lints in methods module #6886) - misc (instead of creating a new directory named
misc
, split the lints one by one, and move them into where they fit most. ) - misc_early (same as
misc
) (in progress by @TaKO8Ki Refactor: arrange lints in misc_early module #7166, [Tracking Issue] Refactor lints in misc_early module #7208) - matches (in progress by @Y-Nak)
How to rearrange is like the following, proposed by @flip1995 on zulip
I would keep the declare_clippy_lint! in the mod.rs Best case would be that mod.rs only contains the lint definitions and the LintPass impl. Utility functions of the module should probably go in methods/utils.rs and then reexported for the module in mod.rs.
proposed by @camsteffen:
For each lint, create a new module at clippy_lints/src/<group_name>/<lint_name>.rs. Within that module, add a function fn check(cx, ..) (with any needed arguments) and move the implementation there.