Skip to content

chore: add clippy::arithmetic-side-effects lint and fix resulting warnings#1081

Merged
Fraser999 merged 4 commits intomainfrom
fraser/arith-side-effects
May 30, 2024
Merged

chore: add clippy::arithmetic-side-effects lint and fix resulting warnings#1081
Fraser999 merged 4 commits intomainfrom
fraser/arith-side-effects

Conversation

@Fraser999
Copy link
Contributor

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

  • Added --warn clippy::arithmetic-side-effects to the clippy CI target.
  • Fixed resulting warnings.

Testing

No new tests added.

Related Issues

Closes #981.

@Fraser999 Fraser999 requested review from a team as code owners May 17, 2024 15:18
@github-actions github-actions bot added ci issues that are related to ci and github workflows conductor pertaining to the astria-conductor crate proto pertaining to the Astria Protobuf spec sequencer pertaining to the astria-sequencer crate sequencer-relayer pertaining to the astria-sequencer-relayer crate composer pertaining to composer labels May 17, 2024
Copy link
Contributor

@SuperFluffy SuperFluffy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think Value for String, so % can be omitted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strings are Debug formatted by default, so we need the % to force Display.

@Fraser999 Fraser999 enabled auto-merge May 23, 2024 17:01
Copy link
Member

@joroshiba joroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved on infra side

@Fraser999 Fraser999 added this pull request to the merge queue May 30, 2024
Merged via the queue into main with commit ab00633 May 30, 2024
@Fraser999 Fraser999 deleted the fraser/arith-side-effects branch May 30, 2024 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci issues that are related to ci and github workflows composer pertaining to composer conductor pertaining to the astria-conductor crate proto pertaining to the Astria Protobuf spec sequencer pertaining to the astria-sequencer crate sequencer-relayer pertaining to the astria-sequencer-relayer crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable clippy::arithmetic-side-effects

3 participants