Auto merge of #102548 - nikic:inline-cell-replace, r=scottmcm
Mark Cell::replace() as #[inline] Giving this a try based on https://github.com/rust-lang/rust/issues/102539#issuecomment-1264398807.
This commit is contained in:
commit
756e7be5eb
1 changed files with 1 additions and 0 deletions
|
@ -405,6 +405,7 @@ impl<T> Cell<T> {
|
||||||
/// 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,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue