-
Notifications
You must be signed in to change notification settings - Fork 352
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
enable clippy lints against integer casts #2422
Conversation
src/shims/mod.rs
Outdated
@@ -1,3 +1,5 @@ | |||
#![warn(clippy::integer_arithmetic)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how useful this one is... none of he cases are caught, so we could just as well turn on debug asserts in release mode if we haven't already. Would be more readable than the checked math functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
turn on debug asserts in release mode
Any suggestion for how to do that in a way that also applies to the builds produced by rustc? We cannot use cargo profiles.
Also we do have a bunch of arithmetic outside this folder (stacked borrows, data races, weak memory) that I deliberately did not enable this lint for, so there might be a performance difference. But that should be easy to benchmark.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can change Bootstrap's build flags for miri
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I don't expect this to make a difference. It's mostly in math heavy code where this is visible in practice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can change Bootstrap's build flags for miri
How? RUSTFLAGS affects all dependencies so it'll rebuild everything...
I am going to move the contentious part into a separate PR.
@oli-obk I hope the remaining changes are uncontroversial. :) |
They are @bors r+ |
enable clippy lints against integer casts and arithmetic Cc #1236
@bors retry I fixed the PR title |
☀️ Test successful - checks-actions |
pass clippy::integer_arithmetic in our shims `@oli-obk` [raised some concerns](#2422 (comment)) about this one. I still think it is the right call, since I don't see a good way to enable overflow checks for our official release builds. I'm open to suggestions though! Fixes #1236
Cc #1236