Skip to content

Commit

Permalink
sys: use Option's unwrap_unchecked()
Browse files Browse the repository at this point in the history
Now that rust-lang#81383 is available,
start using it.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
  • Loading branch information
ojeda committed Jan 29, 2021
1 parent c4e33b5 commit 684e23a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@
#![feature(nonnull_slice_from_raw_parts)]
#![feature(once_cell)]
#![feature(auto_traits)]
#![feature(option_result_unwrap_unchecked)]
#![feature(or_patterns)]
#![feature(panic_info_message)]
#![feature(panic_internals)]
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/wasm/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub fn my_id() -> u32 {
if MY_ID == 0 {
let mut cur = NEXT_ID.load(SeqCst);
MY_ID = loop {
let next = cur.checked_add(1).unwrap_or_else(|| crate::arch::wasm32::unreachable());
let next = cur.checked_add(1).unwrap_unchecked();
match NEXT_ID.compare_exchange(cur, next, SeqCst, SeqCst) {
Ok(_) => break next,
Err(i) => cur = i,
Expand Down

0 comments on commit 684e23a

Please sign in to comment.