Skip to content

Commit 01c2ac6

Browse files
authored
Implement manual default for BuildTargets (#92)
* Implement manual default for BuildTargets * Use expect for BuildTargets default * Document BuildTargets defaults and derive Eq
1 parent fed9793 commit 01c2ac6

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/runner.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ impl CommandArg {
8080
}
8181
}
8282

83-
#[derive(Debug, Clone, Copy, Default)]
83+
/// Target list passed through to Ninja.
84+
/// An empty slice means “use the defaults” emitted by IR generation
85+
/// (default targets).
86+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8487
pub struct BuildTargets<'a>(&'a [String]);
8588
impl<'a> BuildTargets<'a> {
8689
#[must_use]
@@ -97,6 +100,16 @@ impl<'a> BuildTargets<'a> {
97100
}
98101
}
99102

103+
#[expect(
104+
clippy::derivable_impls,
105+
reason = "Default derive requires 'static lifetime; manual impl returns empty slice."
106+
)]
107+
impl Default for BuildTargets<'_> {
108+
fn default() -> Self {
109+
Self(&[])
110+
}
111+
}
112+
100113
/// Execute the parsed [`Cli`] commands.
101114
///
102115
/// # Errors

0 commit comments

Comments
 (0)