diff options
| author | bors <bors@rust-lang.org> | 2017-06-09 23:19:49 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-06-09 23:19:49 +0000 |
| commit | 60ac9f467cbbf8481a6f09e3e90e470dec85cf65 (patch) | |
| tree | d2e8f91eb7cb3e7594cbefaf71224e12c87cf133 /src/libcore | |
| parent | 3d5b8c6266fd58cefa0d7af8c6115fe22532d069 (diff) | |
| parent | 3be7f8bfed5966ef0f4c9cf348424cf3ebaf0f1e (diff) | |
| download | rust-60ac9f467cbbf8481a6f09e3e90e470dec85cf65.tar.gz rust-60ac9f467cbbf8481a6f09e3e90e470dec85cf65.zip | |
Auto merge of #42573 - frewsxcv:rollup, r=frewsxcv
Rollup of 5 pull requests - Successful merges: #42307, #42385, #42531, #42551, #42558 - Failed merges:
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/cell.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index ea480f38947..e75401f6ce0 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -391,17 +391,17 @@ impl<T> Cell<T> { } } - /// Replaces the contained value. + /// Replaces the contained value, and returns it. /// /// # Examples /// /// ``` /// use std::cell::Cell; /// - /// let c = Cell::new(5); - /// let old = c.replace(10); - /// - /// assert_eq!(5, old); + /// let cell = Cell::new(5); + /// assert_eq!(cell.get(), 5); + /// assert_eq!(cell.replace(10), 5); + /// assert_eq!(cell.get(), 10); /// ``` #[stable(feature = "move_cell", since = "1.17.0")] pub fn replace(&self, val: T) -> T { |
