Nit: unnecessary synchronization in `Lazy::force_mut()`
danielhenrymantilla opened this issue · comments
Daniel Henry-Mantilla commented
Self::force()
has to synchronize the access to the raw value and/or its needed initialization, given its &
-based API, but force_mut()
does not, thanks to the guarantees of &mut
access (e.g., https://doc.rust-lang.org/stable/std/cell/struct.UnsafeCell.html#method.get_mut).
But the current implementation of force_mut()
just defers to force()
:
Lines 767 to 770 in 3514863
Alex Kladov commented
Yup, this indeed should be improved!