Skip to content

Commit 6d5cd6e

Browse files
committed
Auto merge of rust-lang#6264 - matthiaskrgr:ra_setup_no_twice, r=llogiq
cargo dev ra-setup: don't inject deps multiple times if we have already done so Fixes rust-lang#6220 changelog: none
2 parents 4f1240f + 7f3462a commit 6d5cd6e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

clippy_dev/src/ra_setup.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::path::PathBuf;
1111
// code. See https://github.com/rust-analyzer/rust-analyzer/issues/3517 and https://github.com/rust-lang/rust-clippy/issues/5514 for details
1212

1313
pub fn run(rustc_path: Option<&str>) {
14-
// we can unwrap here because the arg is required here
14+
// we can unwrap here because the arg is required by clap
1515
let rustc_path = PathBuf::from(rustc_path.unwrap());
1616
assert!(rustc_path.is_dir(), "path is not a directory");
1717
let rustc_source_basedir = rustc_path.join("compiler");
@@ -49,6 +49,15 @@ fn inject_deps_into_manifest(
4949
cargo_toml: &str,
5050
lib_rs: &str,
5151
) -> std::io::Result<()> {
52+
// do not inject deps if we have aleady done so
53+
if cargo_toml.contains("[target.'cfg(NOT_A_PLATFORM)'.dependencies]") {
54+
eprintln!(
55+
"cargo dev ra-setup: warning: deps already found inside {}, doing nothing.",
56+
manifest_path
57+
);
58+
return Ok(());
59+
}
60+
5261
let extern_crates = lib_rs
5362
.lines()
5463
// get the deps

0 commit comments

Comments
 (0)