Skip to content

Commit

Permalink
Set default crate_type for binaries, examples, tests, and benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Turbo87 authored and LukeMathWalker committed Jun 18, 2024
1 parent 04f4012 commit 2b1a72a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ impl<Metadata: for<'a> Deserialize<'a>> Manifest<Metadata> {
name: Some(package.name.clone()),
path: Some("src/main.rs".to_string()),
edition,
crate_type: Some(vec!["bin".to_string()]),
..Product::default()
})
}
Expand Down Expand Up @@ -327,6 +328,7 @@ fn autoset<T, FS: AbstractFilesystem>(package: &Package<T>, dir: &str, fs: &FS)
name: Some(name.trim_end_matches(".rs").into()),
path: Some(rel_path),
edition,
crate_type: Some(vec!["bin".to_string()]),
..Product::default()
})
} else if let Ok(sub) = fs.file_names_in(&rel_path) {
Expand All @@ -335,6 +337,7 @@ fn autoset<T, FS: AbstractFilesystem>(package: &Package<T>, dir: &str, fs: &FS)
name: Some(name.into()),
path: Some(rel_path + "/main.rs"),
edition,
crate_type: Some(vec!["bin".to_string()]),
..Product::default()
})
}
Expand Down
6 changes: 5 additions & 1 deletion tests/snapshots/parse__autobin.snap
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ Manifest {
E2018,
),
required_features: [],
crate_type: None,
crate_type: Some(
[
"bin",
],
),
},
],
bench: [],
Expand Down

0 comments on commit 2b1a72a

Please sign in to comment.