While taking a look at the source code of a project I've been playing with (the awesome ggez) I noticed that the CI was failing on a cargo clippy check... Failing CI runs never sit well with me, so I thought I would help the maintainer by getting these clippy checks passing.

This was a little more difficult than I had anticipated. I had not realized that clippy is actually linting all of a project's dependencies, and the failing check was actually in another, 3rd Party library. This is obviously a Not Good situation, as any of the 3rd Party libraries changing could cause the CI to fail. Not desirable behaviour for an automated check at all.

After quite a bit of digging around in docs I eventually discovered an invocation of Clippy that only checked our own code (in this case, ggez):

cargo clippy --all-targets --package ggez -- -D warnings

This is a pretty standard invocation:
--all-targets : Tell Cargo to compile all targets (ie. bin, libs, examples...)

-D warnings : Tell clippy to "Deny" warnings, leading to a fail return code if any warnings are present.

But with the key addition of:

--package ggez: Tell Cargo to only build the named package.

This is a little difficult to find, so I thought I would share it. For more information about the various flags that you can pass to Cargo, check out the cargo book. The section relevant to this is here.