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