We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
try_unwrap
unwrap_or_drop
1 parent 838e5ed commit 08455a6Copy full SHA for 08455a6
library/alloc/src/sync/tests.rs
@@ -112,11 +112,10 @@ fn unwrap_or_drop() {
112
for _ in 0..100
113
// ^ increase chances of hitting uncommon race conditions
114
{
115
- use std::sync::Arc;
116
let x = Arc::new(3);
117
let y = Arc::clone(&x);
118
- let r_thread = std::thread::spawn(|| Arc::try_unwrap(x).ok());
119
- let s_thread = std::thread::spawn(|| Arc::try_unwrap(y).ok());
+ let r_thread = std::thread::spawn(|| Arc::unwrap_or_drop(x));
+ let s_thread = std::thread::spawn(|| Arc::unwrap_or_drop(y));
120
let r = r_thread.join().expect("r_thread panicked");
121
let s = s_thread.join().expect("s_thread panicked");
122
assert!(
0 commit comments