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
It should deny or warn when a predicate is checked by both an assert (or any similar built-in macro) and any conditional control-flow construct, in any order
Advantage
It removes a redundant check that's certainly a bug
Less confusion for readers
No change in code-gen, as the optimizer could catch the dupe and eliminate it
Drawbacks
False negatives because of custom macros
Cannot be auto-fixed, because intent isn't clear (wrong?)
Example
fnf<T: std::fmt::Debug + PartialEq>(a:T,b:T){if a == b {assert_eq!(a, b);// do something}}fng<T: std::fmt::Debug + PartialEq>(a:T,b:T){assert_eq!(a, b);if a == b {// do something}}
Could be written as:
fnf<T: std::fmt::Debug + PartialEq>(a:T,b:T){if a == b {// do something}}fng<T: std::fmt::Debug + PartialEq>(a:T,b:T){assert_eq!(a, b);// do something}
The text was updated successfully, but these errors were encountered:
What it does
It should
deny
orwarn
when a predicate is checked by both anassert
(or any similar built-in macro) and any conditional control-flow construct, in any orderAdvantage
Drawbacks
Cannot be auto-fixed, because intent isn't clear(wrong?)Example
Could be written as:
The text was updated successfully, but these errors were encountered: