-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Arithmetic lint #8903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This could be a restriction lint, and we may even want to make types to block arithmetic on configurable. |
Does it make sense to lint on types like std::num::Wrapping or std::num::Saturating? These can't overflow or panic (apart from |
Like @llogiq said, types should be configurable. Built-in types that don't panic would then be listed as allowed somehow. I was thinking about creating an |
[1/N] Implement Arithmetic lint Assuming that #8903 is OK, this PR starts the creation of the `Arithmetic` lint with configurable types. My current struggle to get a rustc review inspired me to create smaller PRs in order to easy review and make merges as fast as possible. So the first step here only moves the `arithmetic.rs` file to `numeric_arithmetic.rs` to make room for the new lint. -- changelog: none
Are you guys open to include an allow-by-default restricted lint that will warn
+
/-
//
/*
regardless of the involved type? For example,num-bigint
(among others) has arithmetic implementations that aren't triggered byclippy::integer_arithmetic
.If yes, then I will create a PR. If not, then feel free to close this issue.
The text was updated successfully, but these errors were encountered: