mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 13:33:31 +00:00
Avoid cloning deps
This commit is contained in:
parent
9df73c6cb0
commit
00a049b585
1 changed files with 6 additions and 3 deletions
|
@ -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()),
|
||||||
|
|
Loading…
Reference in a new issue