#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

#482 in Build Utils

Download history 9/week @ 2024-06-30 40/week @ 2024-07-07 7/week @ 2024-07-14 23/week @ 2024-07-21 22/week @ 2024-07-28 223/week @ 2024-08-04 494/week @ 2024-08-11 624/week @ 2024-08-18 630/week @ 2024-08-25 611/week @ 2024-09-01 553/week @ 2024-09-08 43/week @ 2024-09-15 28/week @ 2024-09-22 37/week @ 2024-09-29 30/week @ 2024-10-06 83/week @ 2024-10-13

181 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
~60K SLoC