From 3f197507ba50419fae52bab6dfb10226871d9c80 Mon Sep 17 00:00:00 2001 From: Joshua Kifer Date: Fri, 25 Mar 2022 08:48:08 -0600 Subject: [PATCH 1/2] Take executable from configured bin --- src/config.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index 9d2bfb870..0ea8abd94 100644 --- a/src/config.rs +++ b/src/config.rs @@ -141,8 +141,9 @@ impl CrateConfig { // We just assume they're using a 'main.rs' // Anyway, we've already parsed the manifest, so it should be easy to change the type let output_filename = manifest - .lib - .as_ref() + .bin + .first() + .or(manifest.lib.as_ref()) .and_then(|lib| lib.name.clone()) .or_else(|| manifest.package.as_ref().map(|pkg| pkg.name.clone())) .expect("No lib found from cargo metadata"); From f0fe62e4d5f1656f949c32bac37e970fa1412b55 Mon Sep 17 00:00:00 2001 From: Joshua Kifer Date: Sat, 26 Mar 2022 19:22:09 -0600 Subject: [PATCH 2/2] Improve one var name --- src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index 0ea8abd94..af76b9576 100644 --- a/src/config.rs +++ b/src/config.rs @@ -144,7 +144,7 @@ impl CrateConfig { .bin .first() .or(manifest.lib.as_ref()) - .and_then(|lib| lib.name.clone()) + .and_then(|product| product.name.clone()) .or_else(|| manifest.package.as_ref().map(|pkg| pkg.name.clone())) .expect("No lib found from cargo metadata"); let executable = ExecutableType::Binary(output_filename);