You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 allowing some item somehwere).
My question is, would you know a way to, based on some global attribute or flag, make those allows stricter? Some way to disable those allows (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_u64asusize;// compiles without error
#![deny(clippy::pedantic)]#![deny(unjustified_attrs)]// <--- made that up#[allow(clippy::cast_possible_truncation)]let a = 222_u64asusize;// 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_u64asusize;// 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 allows would be allowed conditionally somehow (such as only with the just attr).
The text was updated successfully, but these errors were encountered:
where I try to put/move as many lints (or group of lints) towards forbid as possible.
I suggest not doing that because it erases the difference between warnings and errors. Use deny(warnings) instead.
My question is, would you know a way to, based on some global attribute or flag, make those allows stricter? Some way to disable those allows (which would compile-time error on clippy) based on a condition?
There is cfg_attr(condition, allow(lint)), but I'm not sure if that's what you're looking for?
#[just(abc123)]// <--- made that up#[allow(clippy::cast_possible_truncation)]
Attributes do not modify other attributes. Attributes modify the item or statement below.
Closing since I don't think this is actionable but feel free to comment further.
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
andallow
, 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 butallow
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 thoseallow
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:
Another way of getting the same dynamic would be to have an intermediary setting between
deny
andforbid
, whereallow
s would be allowed conditionally somehow (such as only with thejust
attr).The text was updated successfully, but these errors were encountered: