Skip to content

Commit c3424dc

Browse files
jdxclaude
andcommitted
fix: use field assignment instead of struct literal for non-exhaustive Spec in benchmarks
Benchmarks are compiled as separate crates, so constructing a #[non_exhaustive] struct with struct literal syntax causes E0639. Use Default::default() with field assignment instead. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 743efec commit c3424dc

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

lib/benches/parse.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ fn build_small_spec() -> Spec {
1616
.build();
1717
cmd.subcommands.insert("install".to_string(), install_cmd);
1818

19-
Spec {
20-
name: "test".to_string(),
21-
bin: "test".to_string(),
22-
cmd,
23-
..Default::default()
24-
}
19+
let mut spec = Spec::default();
20+
spec.name = "test".to_string();
21+
spec.bin = "test".to_string();
22+
spec.cmd = cmd;
23+
spec
2524
}
2625

2726
fn build_large_spec() -> Spec {
@@ -85,12 +84,11 @@ fn build_large_spec() -> Spec {
8584
.build();
8685
cmd.subcommands = subcommands;
8786

88-
Spec {
89-
name: "bench".to_string(),
90-
bin: "bench".to_string(),
91-
cmd,
92-
..Default::default()
93-
}
87+
let mut spec = Spec::default();
88+
spec.name = "bench".to_string();
89+
spec.bin = "bench".to_string();
90+
spec.cmd = cmd;
91+
spec
9492
}
9593

9694
fn bench_parse_small_spec(c: &mut Criterion) {

0 commit comments

Comments
 (0)