Skip to content

Commit 192073b

Browse files
committed
push the rest of the clones to the bottom
1 parent 4fb53e5 commit 192073b

File tree

7 files changed

+13
-15
lines changed

7 files changed

+13
-15
lines changed

src/cargo/core/registry.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,7 @@ impl<'cfg> PackageRegistry<'cfg> {
304304
fn load(&mut self, source_id: SourceId, kind: Kind) -> CargoResult<()> {
305305
(|| {
306306
debug!("loading source {}", source_id);
307-
let source = self
308-
.source_config
309-
.load(source_id, self.yanked_whitelist.clone())?;
307+
let source = self.source_config.load(source_id, &self.yanked_whitelist)?;
310308
assert_eq!(source.source_id(), source_id);
311309

312310
if kind == Kind::Override {

src/cargo/core/source/source_id.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ impl SourceId {
261261
pub fn load<'a>(
262262
self,
263263
config: &'a Config,
264-
yanked_whitelist: HashSet<PackageId>,
264+
yanked_whitelist: &HashSet<PackageId>,
265265
) -> CargoResult<Box<dyn super::Source + 'a>> {
266266
trace!("loading SourceId; {}", self);
267267
match self.inner.kind {

src/cargo/ops/cargo_install.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ fn install_one(
181181
})?
182182
} else {
183183
select_pkg(
184-
map.load(source_id, HashSet::new())?,
184+
map.load(source_id, &HashSet::new())?,
185185
krate,
186186
vers,
187187
config,

src/cargo/ops/registry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ pub fn registry(
350350
let token = token.or(token_config);
351351
let sid = get_source_id(config, index_config.or(index), registry)?;
352352
let api_host = {
353-
let mut src = RegistrySource::remote(sid, HashSet::new(), config);
353+
let mut src = RegistrySource::remote(sid, &HashSet::new(), config);
354354
// Only update the index if the config is not available or `force` is set.
355355
let cfg = src.config();
356356
let cfg = if force_update || cfg.is_err() {
@@ -696,7 +696,7 @@ fn get_source_id(
696696
(_, Some(i)) => SourceId::for_registry(&i.to_url()?),
697697
_ => {
698698
let map = SourceConfigMap::new(config)?;
699-
let src = map.load(SourceId::crates_io(config)?, HashSet::new())?;
699+
let src = map.load(SourceId::crates_io(config)?, &HashSet::new())?;
700700
Ok(src.replaced_source_id())
701701
}
702702
}

src/cargo/sources/config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'cfg> SourceConfigMap<'cfg> {
7676
pub fn load(
7777
&self,
7878
id: SourceId,
79-
yanked_whitelist: HashSet<PackageId>,
79+
yanked_whitelist: &HashSet<PackageId>,
8080
) -> CargoResult<Box<dyn Source + 'cfg>> {
8181
debug!("loading: {}", id);
8282
let mut name = match self.id2name.get(&id) {
@@ -120,8 +120,8 @@ impl<'cfg> SourceConfigMap<'cfg> {
120120
)
121121
}
122122
}
123-
let new_src = new_id.load(self.config, yanked_whitelist.clone())?;
124-
let old_src = id.load(self.config, yanked_whitelist.clone())?;
123+
let new_src = new_id.load(self.config, yanked_whitelist)?;
124+
let old_src = id.load(self.config, yanked_whitelist)?;
125125
if !new_src.supports_checksums() && old_src.supports_checksums() {
126126
failure::bail!(
127127
"\

src/cargo/sources/registry/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ fn short_name(id: SourceId) -> String {
389389
impl<'cfg> RegistrySource<'cfg> {
390390
pub fn remote(
391391
source_id: SourceId,
392-
yanked_whitelist: HashSet<PackageId>,
392+
yanked_whitelist: &HashSet<PackageId>,
393393
config: &'cfg Config,
394394
) -> RegistrySource<'cfg> {
395395
let name = short_name(source_id);
@@ -412,7 +412,7 @@ impl<'cfg> RegistrySource<'cfg> {
412412
config,
413413
&name,
414414
Box::new(ops),
415-
HashSet::new(),
415+
&HashSet::new(),
416416
false,
417417
)
418418
}
@@ -422,7 +422,7 @@ impl<'cfg> RegistrySource<'cfg> {
422422
config: &'cfg Config,
423423
name: &str,
424424
ops: Box<dyn RegistryData + 'cfg>,
425-
yanked_whitelist: HashSet<PackageId>,
425+
yanked_whitelist: &HashSet<PackageId>,
426426
index_locked: bool,
427427
) -> RegistrySource<'cfg> {
428428
RegistrySource {
@@ -431,7 +431,7 @@ impl<'cfg> RegistrySource<'cfg> {
431431
source_id,
432432
updated: false,
433433
index: index::RegistryIndex::new(source_id, ops.index_path(), config, index_locked),
434-
yanked_whitelist,
434+
yanked_whitelist: yanked_whitelist.clone(),
435435
index_locked,
436436
ops,
437437
}

tests/testsuite/search.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ fn not_update() {
108108

109109
let sid = SourceId::for_registry(&registry_url()).unwrap();
110110
let cfg = Config::new(Shell::new(), paths::root(), paths::home().join(".cargo"));
111-
let mut regsrc = RegistrySource::remote(sid, HashSet::new(), &cfg);
111+
let mut regsrc = RegistrySource::remote(sid, &HashSet::new(), &cfg);
112112
regsrc.update().unwrap();
113113

114114
cargo_process("search postgres")

0 commit comments

Comments
 (0)