Description
Hello, I really don't know if this issue should be in here,
I'm currently using 4 attributes blocks on my lib.rs
': forbid
, deny
, warn
and allow
, in order, where I try to put/move as many lints (or group of lints) towards forbid as possible.
Some will stay stuck at deny
level (for when I can't escape but allow
ing some item somehwere).
My question is, would you know a way to, based on some global attribute or flag, make those allow
s stricter? Some way to disable those allow
s (which would compile-time error on clippy) based on a condition?
I'm thinking of requiring some justification mechanism on every allow
, such a reference into some document.
For example:
#![deny(clippy::pedantic)]
#![allow(unjustified_attrs)] // <--- made that up
#[allow(clippy::cast_possible_truncation)]
let a = 222_u64 as usize;
// compiles without error
#![deny(clippy::pedantic)]
#![deny(unjustified_attrs)] // <--- made that up
#[allow(clippy::cast_possible_truncation)]
let a = 222_u64 as usize;
// will not compile because lacks justification
#![deny(clippy::pedantic)]
#![deny(unjustified_attrs)] // <--- made that up
#[just(abc123)] // <--- made that up
#[allow(clippy::cast_possible_truncation)]
let a = 222_u64 as usize;
// compiles without error because this allow is justified
Another way of getting the same dynamic would be to have an intermediary setting between deny
and forbid
, where allow
s would be allowed conditionally somehow (such as only with the just
attr).