Skip to content

Commit 865a847

Browse files
committed
push the rest of the clones to the bottom
1 parent 4481276 commit 865a847

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
@@ -187,7 +187,7 @@ fn install_one(
187187
})?
188188
} else {
189189
select_pkg(
190-
map.load(source_id, HashSet::new())?,
190+
map.load(source_id, &HashSet::new())?,
191191
krate,
192192
vers,
193193
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
@@ -388,7 +388,7 @@ fn short_name(id: SourceId) -> String {
388388
impl<'cfg> RegistrySource<'cfg> {
389389
pub fn remote(
390390
source_id: SourceId,
391-
yanked_whitelist: HashSet<PackageId>,
391+
yanked_whitelist: &HashSet<PackageId>,
392392
config: &'cfg Config,
393393
) -> RegistrySource<'cfg> {
394394
let name = short_name(source_id);
@@ -411,7 +411,7 @@ impl<'cfg> RegistrySource<'cfg> {
411411
config,
412412
&name,
413413
Box::new(ops),
414-
HashSet::new(),
414+
&HashSet::new(),
415415
false,
416416
)
417417
}
@@ -421,7 +421,7 @@ impl<'cfg> RegistrySource<'cfg> {
421421
config: &'cfg Config,
422422
name: &str,
423423
ops: Box<dyn RegistryData + 'cfg>,
424-
yanked_whitelist: HashSet<PackageId>,
424+
yanked_whitelist: &HashSet<PackageId>,
425425
index_locked: bool,
426426
) -> RegistrySource<'cfg> {
427427
RegistrySource {
@@ -430,7 +430,7 @@ impl<'cfg> RegistrySource<'cfg> {
430430
source_id,
431431
updated: false,
432432
index: index::RegistryIndex::new(source_id, ops.index_path(), config, index_locked),
433-
yanked_whitelist,
433+
yanked_whitelist: yanked_whitelist.clone(),
434434
index_locked,
435435
ops,
436436
}

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)