Skip to content

Commit 16e6b0a

Browse files
Update library/core/src/iter/range.rs
Co-authored-by: Carolyn Zech <[email protected]>
1 parent 0ccaf2f commit 16e6b0a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

library/core/src/iter/range.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,11 @@ impl Step for char {
503503
}
504504

505505
#[requires({
506-
let dist = (start as u32).checked_add(count as u32);
507-
dist.is_some() &&
508-
((start as u32) >= 0xD800 || dist.unwrap() < 0xD800 ||
509-
dist.unwrap().checked_add(0x800).is_some())
506+
(start as u32).checked_add(count as u32).is_some_and(|dist|
507+
(start as u32) >= 0xD800 ||
508+
dist < 0xD800 ||
509+
dist.checked_add(0x800).is_some()
510+
)
510511
})]
511512
#[inline]
512513
unsafe fn forward_unchecked(start: char, count: usize) -> char {

0 commit comments

Comments
 (0)