@@ -120,14 +120,14 @@ impl RegistryCredentialConfig {
120
120
/// `registry`, or `index` are set, then uses `crates-io`.
121
121
/// * `force_update`: If `true`, forces the index to be updated.
122
122
/// * `token_required`: If `true`, the token will be set.
123
- fn registry (
124
- gctx : & GlobalContext ,
123
+ fn registry < ' gctx > (
124
+ gctx : & ' gctx GlobalContext ,
125
125
source_ids : & RegistrySourceIds ,
126
126
token_from_cmdline : Option < Secret < & str > > ,
127
127
reg_or_index : Option < & RegistryOrIndex > ,
128
128
force_update : bool ,
129
129
token_required : Option < Operation < ' _ > > ,
130
- ) -> CargoResult < Registry > {
130
+ ) -> CargoResult < ( Registry , RegistrySource < ' gctx > ) > {
131
131
let is_index = reg_or_index. map ( |v| v. is_index ( ) ) . unwrap_or_default ( ) ;
132
132
if is_index && token_required. is_some ( ) && token_from_cmdline. is_none ( ) {
133
133
bail ! ( "command-line argument --index requires --token to be specified" ) ;
@@ -136,9 +136,9 @@ fn registry(
136
136
auth:: cache_token_from_commandline ( gctx, & source_ids. original , token) ;
137
137
}
138
138
139
+ let mut src = RegistrySource :: remote ( source_ids. replacement , & HashSet :: new ( ) , gctx) ?;
139
140
let cfg = {
140
141
let _lock = gctx. acquire_package_cache_lock ( CacheLockMode :: DownloadExclusive ) ?;
141
- let mut src = RegistrySource :: remote ( source_ids. replacement , & HashSet :: new ( ) , gctx) ?;
142
142
// Only update the index if `force_update` is set.
143
143
if force_update {
144
144
src. invalidate_cache ( )
@@ -170,11 +170,9 @@ fn registry(
170
170
None
171
171
} ;
172
172
let handle = http_handle ( gctx) ?;
173
- Ok ( Registry :: new_handle (
174
- api_host,
175
- token,
176
- handle,
177
- cfg. auth_required ,
173
+ Ok ( (
174
+ Registry :: new_handle ( api_host, token, handle, cfg. auth_required ) ,
175
+ src,
178
176
) )
179
177
}
180
178
0 commit comments