If you're as pedantic as me, add this Clippy config to your Cargo.toml
One of the main reasons I love Rust is because it encourages you to be pedantic.
I admire Clippy and the first things I do after a new Rust version is to fix all their new pedantic lints.
Before important PR merges and releases I always used to run cargo clippy -- -W clippy::pedantic and search for unwraps, expects, panics and other possible clauses that could result in a runtime panic.
Today I decided to make clippy::pedantic my default and to enforce checks on possible panic sites
Probably many of you already know this, but much of this can be made automated by adding a section like the following to your project's Cargo.toml
[lints.clippy]
pedantic = { level = "warn", priority = -1 }
unwrap_used = "warn"
expect_used = "warn"
panic = "warn"
todo = "warn"
unimplemented = "warn"
unreachable = "warn"
dbg_macro = "warn"
print_stdout = "warn"
print_stderr = "warn"
This paired with a cargo clippy -- -D warnings in your CI/CD is a really good combo in my opinion.
The three last lints are just useful in case you want to be sure that you're not forgetting any test print on the terminal.
Each of them can of course be disabled locally on a specific file / method / line with the usual directive #[allow(clippy::name_of_the_lint)]