Skip to content

Commit 684e23a

Browse files
committed
sys: use Option's unwrap_unchecked()
Now that rust-lang#81383 is available, start using it. Signed-off-by: Miguel Ojeda <[email protected]>
1 parent c4e33b5 commit 684e23a

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

library/std/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@
290290
#![feature(nonnull_slice_from_raw_parts)]
291291
#![feature(once_cell)]
292292
#![feature(auto_traits)]
293+
#![feature(option_result_unwrap_unchecked)]
293294
#![feature(or_patterns)]
294295
#![feature(panic_info_message)]
295296
#![feature(panic_internals)]

library/std/src/sys/wasm/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub fn my_id() -> u32 {
8686
if MY_ID == 0 {
8787
let mut cur = NEXT_ID.load(SeqCst);
8888
MY_ID = loop {
89-
let next = cur.checked_add(1).unwrap_or_else(|| crate::arch::wasm32::unreachable());
89+
let next = cur.checked_add(1).unwrap_unchecked();
9090
match NEXT_ID.compare_exchange(cur, next, SeqCst, SeqCst) {
9191
Ok(_) => break next,
9292
Err(i) => cur = i,

0 commit comments

Comments
 (0)