[`manual_div_ceil`]: init
Suggest using div_ceil() instead of manual implementation for basic cases.
Partially fixes #12894
changelog: new lint: [manual_div_ceil]
r? @blyxyas
rustbot has assigned @blyxyas. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.
Use r? to explicitly pick a reviewer
See #12894 for more details
Not related, but maybe we should do some benchmarks on (a + (b - 1)) / b vs div_ceil, it seems to be 1 instruction faster
:umbrella: The latest upstream changes (presumably #12873) made this pull request unmergeable. Please resolve the merge conflicts.
Looking at lintcheck, all new lint suggestions are valid, so no FPs there. But the suggestions generation for macros is broken:
warning: manually reimplementing `div_ceil`
--> target/lintcheck/sources/rand_core-0.6.0/src/impls.rs:59:26
|
59 | let chunk_size = (chunk_size_u8 + SIZE - 1) / SIZE;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `chunk_size_u8.div_ceil(fill_via_chunks!(src, dest, u64))`
...
132 | fill_via_chunks!(src, dest, u64)
| -------------------------------- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
= note: this warning originates in the macro `fill_via_chunks` (in Nightly builds, run with -Z macro-backtrace for more info)
:umbrella: The latest upstream changes (presumably #11476) made this pull request unmergeable. Please resolve the merge conflicts.
I've done some updating. But I'm not being able to replicate the macro bug that Philipp is talking about, is there any more information? @belyakov-am Can you replicate it?
If we're not able to replicate it, we can safely merge this.
:umbrella: The latest upstream changes (presumably #13247) made this pull request unmergeable. Please resolve the merge conflicts.
Thanks! And sorry for disappearing for so long I wasn't able to reproduce this one
I also doesn't show up in the latest lintcheck run anymore. So I guess my concern is resolved.
Just looked at lintcheck, everything looks correct!
@bors r+
:pushpin: Commit 9415e6e6eb9a570acecebd3dda0ed2b5db9fb910 has been approved by blyxyas
It is now in the queue for this repository.
:hourglass: Testing commit 9415e6e6eb9a570acecebd3dda0ed2b5db9fb910 with merge 9e9042a11074c83a2c40b4e8ce29f9e2bb610d34...
:sunny: Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test Approved by: blyxyas Pushing 9e9042a11074c83a2c40b4e8ce29f9e2bb610d34 to master...