diff options
| author | Mike Hommey <mh@glandium.org> | 2018-04-04 19:30:46 +0900 |
|---|---|---|
| committer | Mike Hommey <mh@glandium.org> | 2018-04-04 19:30:46 +0900 |
| commit | 4577da75f4badd66a337eb15da76ca836ab1ad6e (patch) | |
| tree | cb2e71939bcdf1bcd5475d4d2c7cd2f1aca800c6 /src/libstd/sys/windows/mutex.rs | |
| parent | 199b7e211d6d9173fded261e0a4de984efc0c2eb (diff) | |
| download | rust-4577da75f4badd66a337eb15da76ca836ab1ad6e.tar.gz rust-4577da75f4badd66a337eb15da76ca836ab1ad6e.zip | |
Use box syntax instead of Box::new in Mutex::remutex on Windows
The Box::new(mem::uninitialized()) pattern actually actively copies uninitialized bytes from the stack into the box, which is a waste of time. Using the box syntax instead avoids the useless copy.
Diffstat (limited to 'src/libstd/sys/windows/mutex.rs')
| -rw-r--r-- | src/libstd/sys/windows/mutex.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/sys/windows/mutex.rs b/src/libstd/sys/windows/mutex.rs index 85560368590..9bf9f749d4d 100644 --- a/src/libstd/sys/windows/mutex.rs +++ b/src/libstd/sys/windows/mutex.rs @@ -117,7 +117,7 @@ impl Mutex { 0 => {} n => return n as *mut _, } - let mut re = Box::new(ReentrantMutex::uninitialized()); + let mut re = box ReentrantMutex::uninitialized(); re.init(); let re = Box::into_raw(re); match self.lock.compare_and_swap(0, re as usize, Ordering::SeqCst) { |
