Skip to content

Commit 017b6cc

Browse files
ci: make CI genuinely green — rust-ci toolchain pin + fmt/clippy (#44)
## Summary Make CI genuinely green. The shared rust-ci pin on `main` predates standards#439, so the SHA-pinned `dtolnay/rust-toolchain` step errors out before the job runs. This bumps the pin so rust-ci actually runs, and brings the Rust sources to fmt + clippy(`-D warnings`) clean under the CI toolchain (stable 1.96). ## Changes - **rust-ci:** bump `rust-ci-reusable.yml` pin `d135b05` → `8dc2bf0` (current `standards` HEAD; includes #439 toolchain fix + #441/#442). - **Rust hygiene:** `cargo fmt` + `clippy --fix` where the repo had pre-existing drift, so `cargo fmt --all -- --check` and `cargo clippy --locked --all-targets -- -D warnings` pass. ## RSR Quality Checklist ### Required - [x] Tests pass (`cargo test --locked --all-targets`) - [x] Code is formatted (`cargo fmt --all -- --check`) - [x] Linter is clean (`cargo clippy --locked --all-targets -- -D warnings`) - [x] No banned language patterns - [x] SPDX license headers present on modified files - [x] No secrets, credentials, or `.env` files included ## Testing Verified locally with the CI toolchain (rustc/clippy/rustfmt 1.96.0): `cargo fmt --check`, `clippy -D warnings`, `cargo check --locked`, `cargo test --locked` all pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- _Generated by [Claude Code](https://claude.ai/code/session_01A6PSzJWpRxtzGDjUCEh7Mx)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent bf39d4b commit 017b6cc

4 files changed

Lines changed: 46 additions & 23 deletions

File tree

.github/workflows/rust-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ permissions:
1414

1515
jobs:
1616
rust-ci:
17-
uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@d135b05bfc647d0c0fbfedc7e80f37ea50f49236
17+
uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@8dc2bf039d1ff0372d650895c46bea7fbaec68ff

src/codegen/build_gen.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ mod tests {
273273
#[test]
274274
fn test_build_script_contains_backend() {
275275
let manifest = test_manifest();
276-
let script = generate_build_script(&manifest, Path::new("test-project.fut")).expect("TODO: handle error");
276+
let script = generate_build_script(&manifest, Path::new("test-project.fut"))
277+
.expect("TODO: handle error");
277278
assert!(script.contains("futhark opencl test-project.fut"));
278279
assert!(!script.contains("autotune"));
279280
}
@@ -282,14 +283,16 @@ mod tests {
282283
fn test_build_script_with_tuning() {
283284
let mut manifest = test_manifest();
284285
manifest.gpu.tuning = true;
285-
let script = generate_build_script(&manifest, Path::new("test-project.fut")).expect("TODO: handle error");
286+
let script = generate_build_script(&manifest, Path::new("test-project.fut"))
287+
.expect("TODO: handle error");
286288
assert!(script.contains("futhark autotune"));
287289
}
288290

289291
#[test]
290292
fn test_build_script_checks_futhark_installed() {
291293
let manifest = test_manifest();
292-
let script = generate_build_script(&manifest, Path::new("test.fut")).expect("TODO: handle error");
294+
let script =
295+
generate_build_script(&manifest, Path::new("test.fut")).expect("TODO: handle error");
293296
assert!(script.contains("command -v futhark"));
294297
}
295298
}

src/codegen/parser.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,8 @@ pub fn parse_single_kernel(raw: &RawKernelConfig) -> Result<KernelConfig> {
5050
);
5151
}
5252
}
53-
SOAC::Histogram => {
54-
if raw.bins.is_none() || raw.bins == Some(0) {
55-
bail!("Kernel '{}': histogram pattern requires bins > 0", raw.name);
56-
}
53+
SOAC::Histogram if (raw.bins.is_none() || raw.bins == Some(0)) => {
54+
bail!("Kernel '{}': histogram pattern requires bins > 0", raw.name);
5755
}
5856
_ => {}
5957
}

src/manifest/mod.rs

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,11 @@ fn validate_kernel(
186186
);
187187
}
188188
}
189-
SOAC::Histogram => {
190-
if kernel.bins.is_none() || kernel.bins == Some(0) {
191-
bail!(
192-
"{}: 'histogram' pattern requires a 'bins' field with a positive integer",
193-
ctx
194-
);
195-
}
189+
SOAC::Histogram if (kernel.bins.is_none() || kernel.bins == Some(0)) => {
190+
bail!(
191+
"{}: 'histogram' pattern requires a 'bins' field with a positive integer",
192+
ctx
193+
);
196194
}
197195
_ => {}
198196
}
@@ -502,20 +500,44 @@ operator = "+"
502500

503501
#[test]
504502
fn test_parse_all_backends() {
505-
assert_eq!(parse_backend("opencl").expect("TODO: handle error"), GPUBackend::OpenCL);
506-
assert_eq!(parse_backend("cuda").expect("TODO: handle error"), GPUBackend::CUDA);
507-
assert_eq!(parse_backend("multicore").expect("TODO: handle error"), GPUBackend::Multicore);
508-
assert_eq!(parse_backend("c").expect("TODO: handle error"), GPUBackend::C);
503+
assert_eq!(
504+
parse_backend("opencl").expect("TODO: handle error"),
505+
GPUBackend::OpenCL
506+
);
507+
assert_eq!(
508+
parse_backend("cuda").expect("TODO: handle error"),
509+
GPUBackend::CUDA
510+
);
511+
assert_eq!(
512+
parse_backend("multicore").expect("TODO: handle error"),
513+
GPUBackend::Multicore
514+
);
515+
assert_eq!(
516+
parse_backend("c").expect("TODO: handle error"),
517+
GPUBackend::C
518+
);
509519
assert!(parse_backend("vulkan").is_err());
510520
}
511521

512522
#[test]
513523
fn test_parse_all_patterns() {
514524
assert_eq!(parse_pattern("map").expect("TODO: handle error"), SOAC::Map);
515-
assert_eq!(parse_pattern("reduce").expect("TODO: handle error"), SOAC::Reduce);
516-
assert_eq!(parse_pattern("scan").expect("TODO: handle error"), SOAC::Scan);
517-
assert_eq!(parse_pattern("scatter").expect("TODO: handle error"), SOAC::Scatter);
518-
assert_eq!(parse_pattern("histogram").expect("TODO: handle error"), SOAC::Histogram);
525+
assert_eq!(
526+
parse_pattern("reduce").expect("TODO: handle error"),
527+
SOAC::Reduce
528+
);
529+
assert_eq!(
530+
parse_pattern("scan").expect("TODO: handle error"),
531+
SOAC::Scan
532+
);
533+
assert_eq!(
534+
parse_pattern("scatter").expect("TODO: handle error"),
535+
SOAC::Scatter
536+
);
537+
assert_eq!(
538+
parse_pattern("histogram").expect("TODO: handle error"),
539+
SOAC::Histogram
540+
);
519541
}
520542

521543
#[test]

0 commit comments

Comments
 (0)