The general-purpose lints use dylint_linting's constituent feature. This allows the lints to be built in either of the following two configurations:
- as individual libraries
- as a single, combined
generallibrary
However, some additional organization of both the general directory and its subdirectories is required.
For the general directory itself:
- Each lint is listed under
[dependencies]in general/Cargo.toml - Each lint is listed under
[workspace.members]in general/Cargo.toml - Each lint's
register_lintsfunction is called from theregister_lintsfunction in src/lib.rs.
For each lint subdirectory:
- The following files do not appear, even though they would be created by
cargo dylint new:- .cargo/config.toml
- .gitignore
- rust-toolchain
- The lint's Cargo.toml has the following
[lib]section (note:crate-typeis not just["cdylib"]):[lib] crate-type = ["cdylib", "rlib"]
- The lint gets its
clippy_utilsdependency from the workspace, i.e.:[dependencies] clippy_utils = { workspace = true }
- The lint's Cargo.toml has the following
[features]section:[features] rlib = ["dylint_linting/constituent"]