-
Notifications
You must be signed in to change notification settings - Fork 1.1k
chore: apply clippy suggestions newly introduced in rust 1.86 #7382
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
chore: apply clippy suggestions newly introduced in rust 1.86 #7382
Conversation
|
There is some discussion of That being said, that discussion was centered around the |
etseidl
left a comment
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.
+1 Thanks @westonpace. I was just about to run down this hole to fix CI when I noticed this PR 😅.
|
I am expecting equivalent machine code due to the operands, but I'll confirm within 30 minutes. |
alamb
left a comment
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.
Thanks @westonpace
I'll wait for @mbutrovich to confirm but then I think we should merge this one in
mbutrovich
left a comment
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.
https://www.diffchecker.com/Kb0zO8go/ the relevant bits are around line 167
The original implementation which is just an add and shift right immediate 6 is gonna be more efficient than the stdlib implementation that includes some conditional increments and conditional sets. That function is written to handle arbitrary operands rather than hardcoded arithmetic, so I'm not sure you'd be able to wrangle equivalent machine code out of the stdlib. It's probably not worth worrying about too much.
|
Thanks for checking @mbutrovich |
Which issue does this PR close?
Rationale for this change
See issue
What changes are included in this PR?
Use
div_ceil(available since rustc 1.73, over 1 year ago)Use
is_emptyinstead oflen() == 0Are there any user-facing changes?
No