Skip to content

Commit cfec6ef

Browse files
Jonathan Bastien-Filiatraultjyn514
Jonathan Bastien-Filiatrault
authored andcommitted
Match library properly if multiple crate-types are in use.
Noticed this, my crate rustyknife was flagged as "not a library". Cargo.toml snippet: [lib] crate-type = ["lib", "cdylib"]
1 parent 3f63280 commit cfec6ef

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/utils/cargo_metadata.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ pub(crate) struct Package {
8080

8181
impl Package {
8282
fn library_target(&self) -> Option<&Target> {
83-
self.targets
84-
.iter()
85-
.find(|target| match target.kind.as_slice() {
86-
[kind] if kind == "lib" || kind == "proc-macro" => true,
87-
_ => false,
88-
})
83+
self.targets.iter().find(|target| {
84+
target
85+
.kind
86+
.iter()
87+
.any(|kind| kind == "lib" || kind == "proc-macro")
88+
})
8989
}
9090

9191
pub(crate) fn is_library(&self) -> bool {

0 commit comments

Comments
 (0)