Mark Cell::replace() as #[inline]

This commit is contained in:
Nikita Popov 2022-10-01 17:30:54 +02:00
parent 744e397d88
commit 49eaa0f6ac

View File

@ -405,6 +405,7 @@ pub fn swap(&self, other: &Self) {
/// assert_eq!(cell.replace(10), 5); /// assert_eq!(cell.replace(10), 5);
/// assert_eq!(cell.get(), 10); /// assert_eq!(cell.get(), 10);
/// ``` /// ```
#[inline]
#[stable(feature = "move_cell", since = "1.17.0")] #[stable(feature = "move_cell", since = "1.17.0")]
pub fn replace(&self, val: T) -> T { pub fn replace(&self, val: T) -> T {
// SAFETY: This can cause data races if called from a separate thread, // SAFETY: This can cause data races if called from a separate thread,