Skip to content

Commit c79e08d

Browse files
authored
Rollup merge of #127122 - TDecking:div_ceil, r=Nilstrieb
Remove uneccessary condition in `div_ceil` Previously, `div_ceil` for unsigned integers had a `rhs > 0` for rounding. That condition however is always fulfilled, since `rhs == 0` would mean a division by zero earlier.
2 parents 5ea1a03 + 5dece2b commit c79e08d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/core/src/num/uint_macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2726,7 +2726,7 @@ macro_rules! uint_impl {
27262726
pub const fn div_ceil(self, rhs: Self) -> Self {
27272727
let d = self / rhs;
27282728
let r = self % rhs;
2729-
if r > 0 && rhs > 0 {
2729+
if r > 0 {
27302730
d + 1
27312731
} else {
27322732
d

0 commit comments

Comments
 (0)