#cargo-workspace #workspace #lint #cargo #diagnostics

build cargo-workspace-lints

Enforce that all packages in a workspace are using workspace lints

1 unstable release

0.1.0 Dec 5, 2023

#521 in Build Utils

Download history 22/week @ 2024-07-26 66/week @ 2024-08-02 475/week @ 2024-08-09 621/week @ 2024-08-16 636/week @ 2024-08-23 613/week @ 2024-08-30 633/week @ 2024-09-06 125/week @ 2024-09-13 31/week @ 2024-09-20 28/week @ 2024-09-27 40/week @ 2024-10-04 85/week @ 2024-10-11 95/week @ 2024-10-18 55/week @ 2024-10-25 46/week @ 2024-11-01 64/week @ 2024-11-08

270 downloads per month

MIT license

12KB
198 lines

Enforce Package use Workspace Lints

Rust dropped a cool new feature in 1.74.0 that enables specifying levels for rustc and clippy lints in your workspace Cargo.toml file, and then the packages in your workspace can all inherit lints from the same source. However, each package in the workspace needs to include a lints.workspace = true line, or else it won't take those lints.

Enter cargo-workspace-lints! Once you install it, all you need to do is run cargo workspace-lints in your workspace, and it will check all the packages in your workspace.

For an example, you can use it on this crate! This crate is not a workspace, so it produces a nice error message:

$ cargo install cargo-workspace-lints --locked
...
$ git checkout https://github.com/JarredAllen/cargo-workspace-lints.git
$ cd cargo-workspace-lints
$ cargo workspace-lints
Failed to validate:
Failing packages:
* Package cargo-workspace-lints 0.1.0 (path+file://home/user/cargo-workspace-lints):
     No `workspace.lints` field found
$ echo $?
1

Run cargo workspace-lints --help for full details of the options with the command.

Dependencies

~2–3MB
~58K SLoC