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
The PR was closed due to inactivity, if anyone is interested in picking up this issue, that PR would be a good starting point. We also discussed, how the lint should behave in that PR.
new lint `legacy_numeric_constants`
Rework of #10997
- uses diagnostic items
- does not lint imports of the float modules (`use std::f32`)
- does not lint usage of float constants that look like `f32::MIN`
I chose to make the float changes because the following pattern is actually pretty useful
```rust
use std::f32;
let omega = freq * 2 * f32::consts::PI;
```
and the float modules are not TBD-deprecated like the integer modules.
Closes#10995
---
changelog: New lint [`legacy_numeric_constants`]
[#12312](#12312)
What it does
This lint triggers on usage of legacy integral constants and functions, such as:
std::i32::MAX
u64::max_value()
Advantage
Enforce a consistent style across the ecosystem.
This lint should probably be placed into the
clippy::style
group.Drawbacks
Older projects will experience some churn, but this should be trivially auto-fixable in most cases.
T-libs-api opposes deprecating this outright so a clippy lint is the next best thing.
Example
Could be written using the associated constant as:
The text was updated successfully, but these errors were encountered: