Talking about unwrapping: I’ve been using a rather aggressive list of clippy lints to prevent myself from getting panics, which are particularly deadly in real-time applications (like video games). unwrap/expect_used already got me 90% of the way out, but looking at the number of as conversions in my codebase, I think I have around 300+ numerical conversions (which can and do fail!) [lints.clippy] all = "deny" unwrap…
We get around it by using conditional compilation and putting the lints in our entrypoints (`main.rs` or `lib.rs`), which is done automatically for any new entrypoint in the codebase via a Make target and some awk magic.
As an example, the following forbids print and dbg statements in release builds (all output should go through logging), allows it with a warning in debug builds, and allows it unconditionally in tests:
#![cfg_attr(not(debug_assertions), deny(clippy::dbg_macro))]
#![cfg_attr(not(debug_assertions), deny(clippy::print_stdout))]
#![cfg_attr(not(debug_assertions), deny(clippy::print_stderr))]
#![cfg_attr(debug_assertions, warn(clippy::dbg_macro))]
#![cfg_attr(debug_assertions, warn(clippy::print_stdout))]
#![cfg_attr(debug_assertions, warn(clippy::print_stderr))]
#![cfg_attr(test, allow(clippy::dbg_macro))]
#![cfg_attr(test, allow(clippy::print_stdout))]
#![cfg_attr(test, allow(clippy::print_stderr))]
AFAIK there isn't currently a way to configure per-profile lints in the top-level Cargo configs. I wish there were.