Avoid cloning deps

This commit is contained in:
mo8it 2024-02-29 17:01:32 +01:00
parent 9df73c6cb0
commit 00a049b585

View file

@ -195,7 +195,10 @@ impl ChangeFixture {
let prev = crates.insert(crate_name.clone(), crate_id); let prev = crates.insert(crate_name.clone(), crate_id);
assert!(prev.is_none(), "multiple crates with same name: {}", crate_name); assert!(prev.is_none(), "multiple crates with same name: {}", crate_name);
for dep in meta.deps { for dep in meta.deps {
let prelude = meta.extern_prelude.contains(&dep); let prelude = match &meta.extern_prelude {
Some(v) => v.contains(&dep),
None => true,
};
let dep = CrateName::normalize_dashes(&dep); let dep = CrateName::normalize_dashes(&dep);
crate_deps.push((crate_name.clone(), dep, prelude)) crate_deps.push((crate_name.clone(), dep, prelude))
} }
@ -443,7 +446,7 @@ struct FileMeta {
path: String, path: String,
krate: Option<(String, CrateOrigin, Option<String>)>, krate: Option<(String, CrateOrigin, Option<String>)>,
deps: Vec<String>, deps: Vec<String>,
extern_prelude: Vec<String>, extern_prelude: Option<Vec<String>>,
cfg: CfgOptions, cfg: CfgOptions,
edition: Edition, edition: Edition,
env: Env, env: Env,
@ -473,7 +476,7 @@ impl FileMeta {
Self { Self {
path: f.path, path: f.path,
krate: f.krate.map(|it| parse_crate(it, current_source_root_kind, f.library)), krate: f.krate.map(|it| parse_crate(it, current_source_root_kind, f.library)),
extern_prelude: f.extern_prelude.unwrap_or_else(|| deps.clone()), extern_prelude: f.extern_prelude,
deps, deps,
cfg, cfg,
edition: f.edition.map_or(Edition::CURRENT, |v| Edition::from_str(&v).unwrap()), edition: f.edition.map_or(Edition::CURRENT, |v| Edition::from_str(&v).unwrap()),