Skip to content

Commit 215871d

Browse files
misc: use anonymous node variable
1 parent 254fff5 commit 215871d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/parking/raw/mutex.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,7 @@ impl<T: ?Sized, P: Park> Mutex<T, P> {
239239
where
240240
F: FnOnce(Option<&mut T>) -> Ret,
241241
{
242-
let mut node = MutexNode::new();
243-
self.try_lock_with_then(&mut node, f)
242+
self.try_lock_with_then(&mut MutexNode::new(), f)
244243
}
245244

246245
/// Attempts to acquire this mutex and then runs a closure against the
@@ -352,8 +351,7 @@ impl<T: ?Sized, P: Park> Mutex<T, P> {
352351
where
353352
F: FnOnce(&mut T) -> Ret,
354353
{
355-
let mut node = MutexNode::new();
356-
self.lock_with_then(&mut node, f)
354+
self.lock_with_then(&mut MutexNode::new(), f)
357355
}
358356

359357
/// Acquires this mutex and then runs the closure against the proteced data.

src/raw/mutex.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,7 @@ impl<T: ?Sized, R: Relax> Mutex<T, R> {
241241
where
242242
F: FnOnce(Option<&mut T>) -> Ret,
243243
{
244-
let mut node = MutexNode::new();
245-
self.try_lock_with_then(&mut node, f)
244+
self.try_lock_with_then(&mut MutexNode::new(), f)
246245
}
247246

248247
/// Attempts to acquire this mutex and then runs a closure against the
@@ -356,8 +355,7 @@ impl<T: ?Sized, R: Relax> Mutex<T, R> {
356355
where
357356
F: FnOnce(&mut T) -> Ret,
358357
{
359-
let mut node = MutexNode::new();
360-
self.lock_with_then(&mut node, f)
358+
self.lock_with_then(&mut MutexNode::new(), f)
361359
}
362360

363361
/// Acquires this mutex and then runs the closure against the proteced data.

0 commit comments

Comments
 (0)