fix testing for packages with multiple targets

fix test running by invoking cargo per package

remove hack_recover_crate_name

make clippy happy

fix testing for packages with multiple targets

fix test running by invoking cargo per package

remove hack_recover_crate_name

make clippy happy

fix testing for packages with multiple targets

fix bad merge

replace TargetKind::fmt with TargetKind::as_cargo_target to clarify intention

dedupulicate requested test runs

replace ParseFromLine with CargoParser

formatting - remove trailing space

formatting for rustfmt CI
This commit is contained in:
duncan 2025-01-22 14:27:27 +00:00
parent 1795a85be3
commit 2f5a7a619d
9 changed files with 186 additions and 143 deletions

View file

@ -224,6 +224,7 @@ pub enum TargetKind {
Example,
Test,
Bench,
/// Cargo calls this kind `custom-build`
BuildScript,
Other,
}
@ -252,6 +253,22 @@ impl TargetKind {
pub fn is_proc_macro(self) -> bool {
matches!(self, TargetKind::Lib { is_proc_macro: true })
}
/// If this is a valid cargo target, returns the name cargo uses in command line arguments
/// and output, otherwise None.
/// https://docs.rs/cargo_metadata/latest/cargo_metadata/enum.TargetKind.html
pub fn as_cargo_target(self) -> Option<&'static str> {
match self {
TargetKind::Bin => Some("bin"),
TargetKind::Lib { is_proc_macro: true } => Some("proc-macro"),
TargetKind::Lib { is_proc_macro: false } => Some("lib"),
TargetKind::Example => Some("example"),
TargetKind::Test => Some("test"),
TargetKind::Bench => Some("bench"),
TargetKind::BuildScript => Some("custom-build"),
TargetKind::Other => None,
}
}
}
#[derive(Default, Clone, Debug, PartialEq, Eq)]