Auto merge of #75912 - scottmcm:manuallydrop-vs-forget, r=Mark-Simulacrum
Suggest `mem::forget` if `mem::ManuallyDrop::new` isn't used I think this communicates the intent more idiomatically, and is shorter anyway. Inspired because [it came up on URLO](https://users.rust-lang.org/t/validity-of-memory-area-after-std-forget/47730/7?u=scottmcm), and it turns out that std had done it too in one spot: 
This commit is contained in:
commit
48717b6f3c
3 changed files with 7 additions and 3 deletions
|
|
@ -293,7 +293,7 @@ impl<T> SyncOnceCell<T> {
|
|||
|
||||
// Don't drop this `SyncOnceCell`. We just moved out one of the fields, but didn't set
|
||||
// the state to uninitialized.
|
||||
mem::ManuallyDrop::new(self);
|
||||
mem::forget(self);
|
||||
inner
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue