diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2022-06-06 13:45:02 +0200 |
|---|---|---|
| committer | Mara Bos <m-ou.se@m-ou.se> | 2022-06-06 13:49:23 +0200 |
| commit | acc3ab4e65cfe4c11156ba7b6be0a33625e7626b (patch) | |
| tree | d55cec960939558db3ffc42cbde223bd74af38cb /library/std/src/sync | |
| parent | e70c60d34b9783a2fd3171d88d248c2e0ec8ecdd (diff) | |
| download | rust-acc3ab4e65cfe4c11156ba7b6be0a33625e7626b.tar.gz rust-acc3ab4e65cfe4c11156ba7b6be0a33625e7626b.zip | |
Make all {Mutex, Condvar, RwLock}::new #[inline].
Diffstat (limited to 'library/std/src/sync')
| -rw-r--r-- | library/std/src/sync/condvar.rs | 3 | ||||
| -rw-r--r-- | library/std/src/sync/mutex.rs | 3 | ||||
| -rw-r--r-- | library/std/src/sync/poison.rs | 1 | ||||
| -rw-r--r-- | library/std/src/sync/rwlock.rs | 3 |
4 files changed, 7 insertions, 3 deletions
diff --git a/library/std/src/sync/condvar.rs b/library/std/src/sync/condvar.rs index 7ff2f330f8a..a1d7b6ff061 100644 --- a/library/std/src/sync/condvar.rs +++ b/library/std/src/sync/condvar.rs @@ -123,7 +123,8 @@ impl Condvar { /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[must_use] - pub fn new() -> Condvar { + #[inline] + pub const fn new() -> Condvar { Condvar { inner: sys::Condvar::new() } } diff --git a/library/std/src/sync/mutex.rs b/library/std/src/sync/mutex.rs index 3d8281fe593..d63f81e68c8 100644 --- a/library/std/src/sync/mutex.rs +++ b/library/std/src/sync/mutex.rs @@ -214,7 +214,8 @@ impl<T> Mutex<T> { /// let mutex = Mutex::new(0); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - pub fn new(t: T) -> Mutex<T> { + #[inline] + pub const fn new(t: T) -> Mutex<T> { Mutex { inner: sys::MovableMutex::new(), poison: poison::Flag::new(), diff --git a/library/std/src/sync/poison.rs b/library/std/src/sync/poison.rs index ba91fb0499f..adef1552016 100644 --- a/library/std/src/sync/poison.rs +++ b/library/std/src/sync/poison.rs @@ -19,6 +19,7 @@ pub struct Flag { // all cases. impl Flag { + #[inline] pub const fn new() -> Flag { Flag { failed: AtomicBool::new(false) } } diff --git a/library/std/src/sync/rwlock.rs b/library/std/src/sync/rwlock.rs index 4f1b4bedaab..ce62c022ae0 100644 --- a/library/std/src/sync/rwlock.rs +++ b/library/std/src/sync/rwlock.rs @@ -146,7 +146,8 @@ impl<T> RwLock<T> { /// let lock = RwLock::new(5); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - pub fn new(t: T) -> RwLock<T> { + #[inline] + pub const fn new(t: T) -> RwLock<T> { RwLock { inner: sys::MovableRwLock::new(), poison: poison::Flag::new(), |
