Remix.run Logo
andy_ppp 11 hours ago

FYI “Rust’s Clippy is a collection of lints (static analysis rules) designed to catch common mistakes and suggest improvements in your Rust code.”

tialaramex 9 hours ago | parent [-]

It's also very tunable. If you (or your team) hate shadowing for example, which is a common idiom in Rust but is often seen as undesirable in other languages, there are several Clippy rules you can enable for a project to either forbid specific kinds of shadowing or introduce a blanket prohibition.

Or at the other end of the scale, the average Rust programmer doesn't care that their code could panic if numbers stop making sense, for example if I'm summing the number of employees who quality for a bonus scheme, the fact that this operation (which I think might reach hundreds but likely is only dozens) could panic if it exceeds u32::MAX isn't worth linting. But if you write jet engine firmware, you need to take such "this can't happen" cases more seriously so you can turn on a lint which forbids these naive operations.