@@ -212,12 +212,12 @@ pub struct GlobalContext {
212212 /// Environment variable snapshot.
213213 env : Env ,
214214 /// Tracks which sources have been updated to avoid multiple updates.
215- updated_sources : OnceLock < Mutex < HashSet < SourceId > > > ,
215+ updated_sources : Mutex < HashSet < SourceId > > ,
216216 /// Cache of credentials from configuration or credential providers.
217217 /// Maps from url to credential value.
218- credential_cache : OnceLock < Mutex < HashMap < CanonicalUrl , CredentialCacheValue > > > ,
218+ credential_cache : Mutex < HashMap < CanonicalUrl , CredentialCacheValue > > ,
219219 /// Cache of registry config from the `[registries]` table.
220- registry_config : OnceLock < Mutex < HashMap < SourceId , Option < RegistryConfig > > > > ,
220+ registry_config : Mutex < HashMap < SourceId , Option < RegistryConfig > > > ,
221221 /// Locks on the package and index caches.
222222 package_cache_lock : CacheLocker ,
223223 /// Cached configuration parsed by Cargo
@@ -526,28 +526,19 @@ impl GlobalContext {
526526
527527 /// Which package sources have been updated, used to ensure it is only done once.
528528 pub fn updated_sources ( & self ) -> MutexGuard < ' _ , HashSet < SourceId > > {
529- self . updated_sources
530- . get_or_init ( || Default :: default ( ) )
531- . lock ( )
532- . unwrap ( )
529+ self . updated_sources . lock ( ) . unwrap ( )
533530 }
534531
535532 /// Cached credentials from credential providers or configuration.
536533 pub fn credential_cache ( & self ) -> MutexGuard < ' _ , HashMap < CanonicalUrl , CredentialCacheValue > > {
537- self . credential_cache
538- . get_or_init ( || Default :: default ( ) )
539- . lock ( )
540- . unwrap ( )
534+ self . credential_cache . lock ( ) . unwrap ( )
541535 }
542536
543537 /// Cache of already parsed registries from the `[registries]` table.
544538 pub ( crate ) fn registry_config (
545539 & self ,
546540 ) -> MutexGuard < ' _ , HashMap < SourceId , Option < RegistryConfig > > > {
547- self . registry_config
548- . get_or_init ( || Default :: default ( ) )
549- . lock ( )
550- . unwrap ( )
541+ self . registry_config . lock ( ) . unwrap ( )
551542 }
552543
553544 /// Gets all config values from disk.
0 commit comments