File tree Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Expand file tree Collapse file tree 1 file changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -384,18 +384,10 @@ impl<T> OnceLock<T> {
384384 where
385385 F : FnOnce ( ) -> Result < T , E > ,
386386 {
387- // Fast path check
388- // NOTE: We need to perform an acquire on the state in this method
389- // in order to correctly synchronize `LazyLock::force`. This is
390- // currently done by calling `self.get()`, which in turn calls
391- // `self.is_initialized()`, which in turn performs the acquire.
392- if let Some ( value) = self . get_mut ( ) {
393- return Ok ( value) ;
387+ if self . get ( ) . is_none ( ) {
388+ self . initialize ( f) ?;
394389 }
395- self . initialize ( f) ?;
396-
397390 debug_assert ! ( self . is_initialized( ) ) ;
398-
399391 // SAFETY: The inner value has been initialized
400392 Ok ( unsafe { self . get_unchecked_mut ( ) } )
401393 }
You can’t perform that action at this time.
0 commit comments