In my Discord today someone brought up how excited they were that Workspace Lint configuration was finally stable, which was new to me!
I Learned about clippy::pedantic
and about turning on lints for an entire workspace!
Lets start there with Workspace Lints! They let you configure which Clippy Lints you opt into (or out of) for the entire workspace.
This requires defining the lints you want to use in the workspace Cargo.toml
file like this
[]
= "deny"
This for instance sets the pedantic
group to deny
so it will cause Clippy to error out for everything in the group.
Now for individual crates to opt into this grouping you need to add the following to their individual Cargo.toml
files
[]
= true
I love Clippy, so when I learned about the clippy:pedantic
group, which makes Clippy even MORE picky I knew I wanted to try it out! It adds a bunch of lints, and as it turns out turning them all on was a bit too much for me. A few conflicted with tools I am using, and some I just disagreed with. But overall it's really cool to be able to opt into a whole group of lints like this!
I opted to use the pedantic
group and then allow the specific lints I didn't agree with. The workspace Cargo.toml
for this site looks like this at the time this TIL was published!
[]
= "deny"
= "allow"
= "allow"
= "allow"
= "allow"
= "allow"
= "allow"
= "allow"
You can see the PR where I added these Lints and fixed up the repo here: https://github.com/coreyja/coreyja.com/pull/64
My weekly newsletter tailored at developers who are eager to grow with me!
Every week will be unique, but expect topics focusing around Web Development and Rust