Skip to content

Commit 222a5be

Browse files
Reuben Brooksclaude
andcommitted
yggdrasil-build: fix pre-existing Gate 1 failures (rustfmt 1.9 drift, clippy collapsible-if)
cargo fmt with the current pinned stable (rustfmt 1.9.0) plus the new clippy collapsible_if lint on the manifest-version match arm — folded into a match guard, behavior unchanged (value == "2" falls through to the ignore-unknown-keys arm). These were failing CI on main before this upgrade. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 340dcb1 commit 222a5be

1 file changed

Lines changed: 22 additions & 10 deletions

File tree

crates/yggdrasil-build/src/main.rs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ fn parse_manifest(path: &Path) -> Result<Manifest, String> {
6060
));
6161
};
6262
match key {
63-
"manifest-version" => {
64-
if value != "2" {
65-
return Err(format!("unsupported manifest-version {value:?} (expected 2)"));
66-
}
63+
"manifest-version" if value != "2" => {
64+
return Err(format!(
65+
"unsupported manifest-version {value:?} (expected 2)"
66+
));
6767
}
6868
"kernel" => m.kernel = value.to_string(),
6969
"init" => m.init = value.to_string(),
@@ -112,7 +112,13 @@ fn compile_options(label: &str) -> CompileOptions {
112112
fn ident_suffix(stem: &str) -> String {
113113
let mut s: String = stem
114114
.chars()
115-
.map(|c| if c.is_ascii_alphanumeric() { c.to_ascii_lowercase() } else { '_' })
115+
.map(|c| {
116+
if c.is_ascii_alphanumeric() {
117+
c.to_ascii_lowercase()
118+
} else {
119+
'_'
120+
}
121+
})
116122
.collect();
117123
if s.chars().next().is_none_or(|c| c.is_ascii_digit()) {
118124
s.insert(0, 'f');
@@ -151,7 +157,10 @@ fn shen_rust_path() -> Result<PathBuf, String> {
151157
if p.join("Cargo.toml").exists() {
152158
return Ok(p);
153159
}
154-
return Err(format!("YGGDRASIL_SHEN_RUST={}: no Cargo.toml there", p.display()));
160+
return Err(format!(
161+
"YGGDRASIL_SHEN_RUST={}: no Cargo.toml there",
162+
p.display()
163+
));
155164
}
156165
let here = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
157166
let candidate = here.join("..").join("shen-rust");
@@ -188,7 +197,7 @@ fn run() -> Result<(), String> {
188197
let manifest_path = shaken.join("yggdrasil.manifest.txt");
189198
let manifest = parse_manifest(&manifest_path)?;
190199
if manifest.init != "shen.initialise" {
191-
// boot_from_kl_source hard-codes shen.initialise (41.1 contract).
200+
// boot_from_kl_source hard-codes shen.initialise (41.x contract).
192201
return Err(format!("unsupported init function {:?}", manifest.init));
193202
}
194203

@@ -204,8 +213,8 @@ fn run() -> Result<(), String> {
204213
.map_err(|e| format!("write kernel.kl: {e}"))?;
205214

206215
let opts = compile_options(&format!("{} (Yggdrasil shaken kernel)", manifest.kernel));
207-
let (kernel_module, kernel_report) =
208-
compile_kl(&kernel_src, &opts).map_err(|e| format!("klcompile {}: {e}", manifest.kernel))?;
216+
let (kernel_module, kernel_report) = compile_kl(&kernel_src, &opts)
217+
.map_err(|e| format!("klcompile {}: {e}", manifest.kernel))?;
209218
fs::write(src_dir.join("kernel_aot.rs"), kernel_module)
210219
.map_err(|e| format!("write kernel_aot.rs: {e}"))?;
211220
eprintln!(
@@ -284,7 +293,10 @@ codegen-units = 1
284293
fs::write(outdir.join(".gitignore"), "/target\n").ok();
285294

286295
eprintln!("scaffolded {}", outdir.display());
287-
eprintln!("build: cargo build --release --manifest-path {}/Cargo.toml", outdir.display());
296+
eprintln!(
297+
"build: cargo build --release --manifest-path {}/Cargo.toml",
298+
outdir.display()
299+
);
288300
Ok(())
289301
}
290302

0 commit comments

Comments
 (0)