diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-04-22 23:19:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-22 23:19:19 +0200 |
| commit | 10e47f5b7b58e1413ddc7cbb3164138c15e9684e (patch) | |
| tree | 943831e633e5f251207108aadea3a926f98f849b /src/libstd/thread | |
| parent | b2e36e6c2d229126b59e892c9147fbb68115d292 (diff) | |
| parent | 7fca9f809da1c65afa09e7d6e35b9599f87f03d3 (diff) | |
| download | rust-10e47f5b7b58e1413ddc7cbb3164138c15e9684e.tar.gz rust-10e47f5b7b58e1413ddc7cbb3164138c15e9684e.zip | |
Rollup merge of #71256 - cuviper:must_use_replace, r=estebank
Lint must_use on mem::replace This adds a hint on `mem::replace`, "if you don't need the old value, you can just assign the new value directly". This is in similar spirit to the `must_use` on `ManuallyDrop::take`.
Diffstat (limited to 'src/libstd/thread')
| -rw-r--r-- | src/libstd/thread/local.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index 29e99c0afd2..094c468a677 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -301,7 +301,7 @@ mod lazy { // value (an aliasing violation). To avoid setting the "I'm running a // destructor" flag we just use `mem::replace` which should sequence the // operations a little differently and make this safe to call. - mem::replace(&mut *ptr, Some(value)); + let _ = mem::replace(&mut *ptr, Some(value)); // After storing `Some` we want to get a reference to the contents of // what we just stored. While we could use `unwrap` here and it should |
