We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 093831b commit ce51089Copy full SHA for ce51089
library/core/src/num/flt2dec/mod.rs
@@ -150,17 +150,13 @@ pub fn round_up(d: &mut [u8]) -> Option<u8> {
150
Some(i) => {
151
// d[i+1..n] is all nines
152
d[i] += 1;
153
- for j in i + 1..d.len() {
154
- d[j] = b'0';
155
- }
+ d.iter_mut().skip(i + 1).for_each(|c| *c = b'0');
156
None
157
}
158
- None if d.len() > 0 => {
+ None if !d.is_empty() => {
159
// 999..999 rounds to 1000..000 with an increased exponent
160
d[0] = b'1';
161
- for j in 1..d.len() {
162
163
+ d.iter_mut().skip(1).for_each(|c| *c = b'0');
164
Some(b'0')
165
166
None => {
0 commit comments