Skip to content

Commit e277f01

Browse files
committed
avoid unnecessary Thread handle allocation
1 parent b5d8108 commit e277f01

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/std/src/sys/unix/locks/queue_rwlock.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ impl Node {
210210
fn prepare(&mut self) {
211211
// Fall back to creating an unnamed `Thread` handle to allow locking in
212212
// TLS destructors.
213-
self.thread.get_or_init(|| thread_info::current_thread().unwrap_or(Thread::new(None)));
213+
self.thread
214+
.get_or_init(|| thread_info::current_thread().unwrap_or_else(|| Thread::new(None)));
214215
self.completed = AtomicBool::new(false);
215216
}
216217

0 commit comments

Comments
 (0)