From 7c7110db9e6fa4484dd5938d41a177ea8345936b Mon Sep 17 00:00:00 2001 From: Nils Homer Date: Thu, 30 Apr 2026 13:08:11 -0700 Subject: [PATCH 1/2] fix(clippy): address new lints from rust-1.95 Three new clippy errors started firing on `-D warnings` after the rust-1.95 release: - `clippy::manual_checked_ops` in src/catalog/builder.rs: rewrite the `pct` closure with `checked_div(total).unwrap_or(0)`, which is semantically identical to the existing `if total == 0 { 0 } else { (n * 100) / total }` form. - `clippy::unnecessary_sort_by` in src/catalog/index.rs (x2): replace `sort_by(|a, b| b.1.cmp(&a.1))` with `sort_by_key(|b| std::cmp::Reverse(b.1))`. Both forms produce a stable sort by `.1` descending. No behavioral change. Unblocks the pre-commit hook so README and other commits can land again. --- src/catalog/builder.rs | 8 +------- src/catalog/index.rs | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/catalog/builder.rs b/src/catalog/builder.rs index 2d8769b..06ed703 100644 --- a/src/catalog/builder.rs +++ b/src/catalog/builder.rs @@ -987,13 +987,7 @@ impl std::fmt::Display for BuildSummary { writeln!(f)?; writeln!(f, "Coverage:")?; - let pct = |n: usize, total: usize| { - if total == 0 { - 0 - } else { - (n * 100) / total - } - }; + let pct = |n: usize, total: usize| (n * 100).checked_div(total).unwrap_or(0); let check = |n: usize, total: usize| { if n == total { "+" diff --git a/src/catalog/index.rs b/src/catalog/index.rs index 1106169..54046f1 100644 --- a/src/catalog/index.rs +++ b/src/catalog/index.rs @@ -30,7 +30,7 @@ impl<'a> CandidateFinder<'a> { } let mut candidates: Vec<_> = ref_counts.into_iter().collect(); - candidates.sort_by(|a, b| b.1.cmp(&a.1)); // Sort by count descending + candidates.sort_by_key(|b| std::cmp::Reverse(b.1)); // Sort by count descending candidates } @@ -68,7 +68,7 @@ impl<'a> CandidateFinder<'a> { } let mut candidates: Vec<_> = ref_counts.into_iter().collect(); - candidates.sort_by(|a, b| b.1.cmp(&a.1)); + candidates.sort_by_key(|b| std::cmp::Reverse(b.1)); candidates } From dcbd55bb26d0c5827ede890314da083947cc53c7 Mon Sep 17 00:00:00 2001 From: Nils Homer Date: Thu, 30 Apr 2026 13:58:28 -0700 Subject: [PATCH 2/2] ci: pin actions to full-length commit SHAs Org policy "all actions must be pinned to a full-length commit SHA" was rejecting CI runs at the workflow setup step. Pin every uses: ref to a 40-char SHA, with the original tag preserved as a trailing comment for human readability. For dtolnay/rust-toolchain and taiki-e/install-action, the action's required input was previously inferred from the ref (@stable, @nextest); since SHA-pinning loses that signal and the action errors out without the input, an explicit `with: toolchain:` / `with: tool:` is added. --- .github/workflows/ci.yml | 26 ++++++++++++++++---------- .github/workflows/deploy-local.yml | 4 ++-- .github/workflows/publish.yml | 8 +++++--- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9924c3..0a63670 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,16 +17,20 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + with: + toolchain: stable - name: Set up compilation cache (sccache) - uses: mozilla-actions/sccache-action@v0.0.9 + uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 - name: Install nextest - uses: taiki-e/install-action@nextest + uses: taiki-e/install-action@e32179aa3c2a47939bd07439bd80ddf13f99979f # nextest + with: + tool: nextest - name: Run tests run: cargo ci-test @@ -35,15 +39,16 @@ jobs: name: Format Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable with: + toolchain: stable components: rustfmt - name: Set up compilation cache (sccache) - uses: mozilla-actions/sccache-action@v0.0.9 + uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 - name: Check formatting run: cargo ci-fmt @@ -52,15 +57,16 @@ jobs: name: Lint Check runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable with: + toolchain: stable components: clippy - name: Set up compilation cache (sccache) - uses: mozilla-actions/sccache-action@v0.0.9 + uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 - name: Run clippy run: cargo ci-lint \ No newline at end of file diff --git a/.github/workflows/deploy-local.yml b/.github/workflows/deploy-local.yml index e103de1..a5e8f2b 100644 --- a/.github/workflows/deploy-local.yml +++ b/.github/workflows/deploy-local.yml @@ -20,7 +20,7 @@ jobs: build-and-deploy: runs-on: [self-hosted, linux, x64, ref-solver-deploy] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - name: Setup Rust run: | @@ -30,7 +30,7 @@ jobs: echo "$HOME/.cargo/bin" >> $GITHUB_PATH - name: Cache cargo registry - uses: actions/cache@v4 + uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 with: path: | ~/.cargo/registry diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f149147..8e7d115 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,14 +14,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 with: fetch-depth: 0 token: ${{ secrets.RELEASE_PLZ_TOKEN }} - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + with: + toolchain: stable - name: Run release-plz - uses: MarcoIeni/release-plz-action@v0.5 + uses: MarcoIeni/release-plz-action@1528104d2ca23787631a1c1f022abb64b34c1e11 # v0.5 env: GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }} CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}