浏览代码

Merge pull request #24 from naturalethic/take-executable-from-configured-bin

Take executable from configured bin
Jon Kelley 3 年之前
父节点
当前提交
278e640c42
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      src/config.rs

+ 4 - 3
src/config.rs

@@ -147,9 +147,10 @@ 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()
-            .and_then(|lib| lib.name.clone())
+            .bin
+            .first()
+            .or(manifest.lib.as_ref())
+            .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);