Skip to content

Commit

Permalink
push the rest of the clones to the bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
Eh2406 committed Jan 29, 2019
1 parent 4fb53e5 commit 192073b
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 15 deletions.
4 changes: 1 addition & 3 deletions src/cargo/core/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,7 @@ impl<'cfg> PackageRegistry<'cfg> {
fn load(&mut self, source_id: SourceId, kind: Kind) -> CargoResult<()> {
(|| {
debug!("loading source {}", source_id);
let source = self
.source_config
.load(source_id, self.yanked_whitelist.clone())?;
let source = self.source_config.load(source_id, &self.yanked_whitelist)?;
assert_eq!(source.source_id(), source_id);

if kind == Kind::Override {
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/source/source_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ impl SourceId {
pub fn load<'a>(
self,
config: &'a Config,
yanked_whitelist: HashSet<PackageId>,
yanked_whitelist: &HashSet<PackageId>,
) -> CargoResult<Box<dyn super::Source + 'a>> {
trace!("loading SourceId; {}", self);
match self.inner.kind {
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ fn install_one(
})?
} else {
select_pkg(
map.load(source_id, HashSet::new())?,
map.load(source_id, &HashSet::new())?,
krate,
vers,
config,
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/ops/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ pub fn registry(
let token = token.or(token_config);
let sid = get_source_id(config, index_config.or(index), registry)?;
let api_host = {
let mut src = RegistrySource::remote(sid, HashSet::new(), config);
let mut src = RegistrySource::remote(sid, &HashSet::new(), config);
// Only update the index if the config is not available or `force` is set.
let cfg = src.config();
let cfg = if force_update || cfg.is_err() {
Expand Down Expand Up @@ -696,7 +696,7 @@ fn get_source_id(
(_, Some(i)) => SourceId::for_registry(&i.to_url()?),
_ => {
let map = SourceConfigMap::new(config)?;
let src = map.load(SourceId::crates_io(config)?, HashSet::new())?;
let src = map.load(SourceId::crates_io(config)?, &HashSet::new())?;
Ok(src.replaced_source_id())
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/cargo/sources/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl<'cfg> SourceConfigMap<'cfg> {
pub fn load(
&self,
id: SourceId,
yanked_whitelist: HashSet<PackageId>,
yanked_whitelist: &HashSet<PackageId>,
) -> CargoResult<Box<dyn Source + 'cfg>> {
debug!("loading: {}", id);
let mut name = match self.id2name.get(&id) {
Expand Down Expand Up @@ -120,8 +120,8 @@ impl<'cfg> SourceConfigMap<'cfg> {
)
}
}
let new_src = new_id.load(self.config, yanked_whitelist.clone())?;
let old_src = id.load(self.config, yanked_whitelist.clone())?;
let new_src = new_id.load(self.config, yanked_whitelist)?;
let old_src = id.load(self.config, yanked_whitelist)?;
if !new_src.supports_checksums() && old_src.supports_checksums() {
failure::bail!(
"\
Expand Down
8 changes: 4 additions & 4 deletions src/cargo/sources/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ fn short_name(id: SourceId) -> String {
impl<'cfg> RegistrySource<'cfg> {
pub fn remote(
source_id: SourceId,
yanked_whitelist: HashSet<PackageId>,
yanked_whitelist: &HashSet<PackageId>,
config: &'cfg Config,
) -> RegistrySource<'cfg> {
let name = short_name(source_id);
Expand All @@ -412,7 +412,7 @@ impl<'cfg> RegistrySource<'cfg> {
config,
&name,
Box::new(ops),
HashSet::new(),
&HashSet::new(),
false,
)
}
Expand All @@ -422,7 +422,7 @@ impl<'cfg> RegistrySource<'cfg> {
config: &'cfg Config,
name: &str,
ops: Box<dyn RegistryData + 'cfg>,
yanked_whitelist: HashSet<PackageId>,
yanked_whitelist: &HashSet<PackageId>,
index_locked: bool,
) -> RegistrySource<'cfg> {
RegistrySource {
Expand All @@ -431,7 +431,7 @@ impl<'cfg> RegistrySource<'cfg> {
source_id,
updated: false,
index: index::RegistryIndex::new(source_id, ops.index_path(), config, index_locked),
yanked_whitelist,
yanked_whitelist: yanked_whitelist.clone(),
index_locked,
ops,
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ fn not_update() {

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

cargo_process("search postgres")
Expand Down

0 comments on commit 192073b

Please sign in to comment.