Delete cargo metadata fail warning

This commit is contained in:
David Tolnay 2023-07-16 13:43:29 -07:00
parent 8d8139502b
commit d319e7afb4
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82

View file

@ -313,18 +313,13 @@ fn apply_args(cmd: &mut Command, args: &Expand, color: &Coloring, outfile: &Path
}
if !has_explicit_build_target {
match cargo_metadata(args.manifest_path.as_deref()) {
Ok(cargo_metadata) => {
if let Some(root_package) = cargo_metadata.root_package() {
if let Some(default_run) = &root_package.default_run {
line.arg("--bin");
line.arg(default_run);
}
if let Ok(cargo_metadata) = cargo_metadata(args.manifest_path.as_deref()) {
if let Some(root_package) = cargo_metadata.root_package() {
if let Some(default_run) = &root_package.default_run {
line.arg("--bin");
line.arg(default_run);
}
}
Err(err) => {
let _ = writeln!(io::stderr(), "WARNING: run cargo metadata fail: {}", err);
}
}
}