Skip to content

Fix clippy errors: resolve always-return-zero operations #3223

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

Closed
wants to merge 1 commit into from

Conversation

Mirebella
Copy link
Contributor

Fix clippy "error: this operation will always return zero".

Error described in https://rust-lang.github.io/rust-clippy/master/index.html#erasing_op

Copy link

codecov bot commented Aug 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.70%. Comparing base (8c1b3d1) to head (8e6998b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3223      +/-   ##
==========================================
+ Coverage   89.69%   89.70%   +0.01%     
==========================================
  Files         122      122              
  Lines      101791   101791              
  Branches   101791   101791              
==========================================
+ Hits        91300    91313      +13     
+ Misses       7791     7779      -12     
+ Partials     2700     2699       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

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

LGMT

Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a comment

Choose a reason for hiding this comment

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

The point of these is that they make the code more readable. The compiler will optimize them out, so there's no harm in keeping them and it makes the code easier to scan. NAK

@Mirebella
Copy link
Contributor Author

@dunxen What do you think?

@dunxen
Copy link
Contributor

dunxen commented Aug 5, 2024

The point of these is that they make the code more readable. The compiler will optimize them out, so there's no harm in keeping them and it makes the code easier to scan. NAK

Agreed, I think it’s more readable the way it currently is. We should probably add a rule ignore in these places if don’t want more PRs opened for these these :)

@Mirebella
Copy link
Contributor Author

Ok then closing. Looks like clippy is not checked anyway in the CI checks.

@Mirebella Mirebella closed this Aug 5, 2024
@TheBlueMatt
Copy link
Collaborator

An ignore rule would be great, though, as we really should be doing clippy checks, its just not something we've historically done. Any desire to push through the clippy checks for us @Mirebella? We could start by just adding all the current clippy violations to an ignore list and checking anything left in CI, then slowly chip away at them.

@Mirebella
Copy link
Contributor Author

@TheBlueMatt I checked and there is already an ignore list:

- name: Run default clippy linting
run: |
cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err

Is this what you had in mind?

It already ignores (allows) the error I wanted to solve in this PR: https://rust-lang.github.io/rust-clippy/master/index.html#erasing_op

@TheBlueMatt
Copy link
Collaborator

Ah, yea, basically, but we should also start making progress on all the clippy warnings and then expanding the deny list there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants