Skip to content

Commit 7cd4f55

Browse files
authored
Rust: QLTest: delete Cargo.lock files
1 parent 01d4c0f commit 7cd4f55

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

rust/extractor/src/qltest.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ path = "main.rs"
4646
manifest.push_str(dep);
4747
manifest.push('\n');
4848
}
49-
}
49+
}
5050
fs::write("Cargo.toml", manifest).context("writing Cargo.toml")
5151
}
5252

@@ -58,9 +58,18 @@ fn set_sources(config: &mut Config) -> anyhow::Result<()> {
5858
Ok(())
5959
}
6060

61+
fn remove_file_if_exists(path: &Path) -> anyhow::Result<()> {
62+
match fs::remove_file(path) {
63+
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(()),
64+
x => x,
65+
}
66+
.context("removing file")
67+
}
68+
6169
pub(crate) fn prepare(config: &mut Config) -> anyhow::Result<()> {
6270
dump_lib()?;
6371
set_sources(config)?;
72+
remove_file_if_exists(Path::new("Cargo.lock"))?;
6473
dump_cargo_manifest(&config.qltest_dependencies)?;
6574
if config.qltest_cargo_check {
6675
let status = Command::new("cargo")

0 commit comments

Comments
 (0)