Use nightly clippy

I don't know who needs to hear this, but .. nightly clippy sometimes adds lints that may not be ready for prime time, but can be useful. For me it has caught a few patterns that stable clippy doesn't catch (those "You can express this block of code using map()" suggestions). Lately it has started telling me when my MSRV in Cargo.toml is wrong, which is hugely appreciated.

Just because you don't want to use the nightly compiler doesn't mean you can't make use of the improvement to the nightly tools.

Standard disclaimer: You probably shouldn't be telling nightly clippy to automatically fix your code -- at least not without committing it the code before running the command.

1 Like

Note that using nightly doesn't get you any “unstable clippy lints”. It just means you are slightly ahead of stable (in the 6-week Rust release schedule) and get new lints a little sooner, but with more chance of bugs. This can be a useful thing to do — I've found and reported many bugs in lints this way — but it doesn't get you any specific advantages that you can't get by waiting 0-6 weeks.

But if you are interested in flawed lints that might be worth using anyway, look at the clippy::nursery lint group. That's where lints that are known to be substantially incomplete or have false positives go, until they're improved, so none of them are enabled by default.

4 Likes