chore: add clippy::arithmetic-side-effects lint and fix resulting warnings#1081
Merged
chore: add clippy::arithmetic-side-effects lint and fix resulting warnings#1081
clippy::arithmetic-side-effects lint and fix resulting warnings#1081Conversation
Fraser999
commented
May 17, 2024
Fraser999
commented
May 17, 2024
Fraser999
commented
May 17, 2024
SuperFluffy
approved these changes
May 21, 2024
Contributor
SuperFluffy
left a comment
There was a problem hiding this comment.
Thank you so much for having dug through the codebase and added these everywhere.
I left a few comments here and there, but I think I mostly agree with the choice of panics vs errors. I tried to tighten the error messages or panics here and there to make them more explicit. Maybe have another pass over them to make sure a reader isn't left guessing?
| if bundles_to_drain.is_empty() { | ||
| info!( | ||
| number_of_submitted_bundles = bundles_drained, | ||
| %number_of_submitted_bundles, |
Contributor
There was a problem hiding this comment.
I think Value for String, so % can be omitted
Contributor
Author
There was a problem hiding this comment.
Strings are Debug formatted by default, so we need the % to force Display.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Added a clippy lint to CI to check for arithmetic side-effects (e.g. overflows).
Background
This is to harden the production codebase.
Changes
--warn clippy::arithmetic-side-effectsto the clippy CI target.Testing
No new tests added.
Related Issues
Closes #981.