Skip to content

Commit 68690b4

Browse files
authored
Merge pull request #19181 from github/aibaars/rust-delete-cargo-lock
Rust: QLTest: delete Cargo.lock files
2 parents f4105ee + 1d49252 commit 68690b4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

rust/extractor/src/qltest.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use glob::glob;
44
use itertools::Itertools;
55
use std::ffi::OsStr;
66
use std::fs;
7+
use std::path::Path;
78
use std::process::Command;
89
use tracing::info;
910

@@ -58,9 +59,18 @@ fn set_sources(config: &mut Config) -> anyhow::Result<()> {
5859
Ok(())
5960
}
6061

62+
fn remove_file_if_exists(path: &Path) -> anyhow::Result<()> {
63+
match fs::remove_file(path) {
64+
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(()),
65+
x => x,
66+
}
67+
.context(format!("removing file {}", path.display()))
68+
}
69+
6170
pub(crate) fn prepare(config: &mut Config) -> anyhow::Result<()> {
6271
dump_lib()?;
6372
set_sources(config)?;
73+
remove_file_if_exists(Path::new("Cargo.lock"))?;
6474
dump_cargo_manifest(&config.qltest_dependencies)?;
6575
if config.qltest_cargo_check {
6676
let status = Command::new("cargo")

0 commit comments

Comments
 (0)