From cb2b6538d1b295adca681ef28009a4f623c9bb04 Mon Sep 17 00:00:00 2001 From: Thomas Frank Date: Wed, 5 Jun 2024 22:57:49 +0200 Subject: [PATCH] Find library names with auto-converted dash to underscore (#294) Co-authored-by: Thomas Frank Co-authored-by: morenol <22335041+morenol@users.noreply.github.com> --- nj-cli/src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nj-cli/src/main.rs b/nj-cli/src/main.rs index 60d38ee3..ef14b946 100644 --- a/nj-cli/src/main.rs +++ b/nj-cli/src/main.rs @@ -168,7 +168,13 @@ fn find_cdylib(package: &Package) -> Option<&Target> { package .targets .iter() - .find(|&target| target.name == package.name) + .find(|&target| target.name == package.name.replace('-', "_")) + .or_else(|| { + package + .targets + .iter() + .find(|&target| target.name == package.name) + }) } fn find_current_package<'a>(metadata: &'a Metadata, manifest_path: &Path) -> Option<&'a Package> {