Skip to content

Commit 06441d5

Browse files
authored
Merge pull request #274 from AdaWorldAPI/claude/x265-x266-plans-review-h9osnl
Rust 1.97.1 + clippy clean (rebased onto master, gates re-verified)
2 parents 417f66a + f4be38a commit 06441d5

11 files changed

Lines changed: 94 additions & 44 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Sonnet clippy lint sweep — rust-toolchain 1.95.0 → 1.97.1
2+
3+
Branch: `claude/x265-x266-plans-review-h9osnl` (shared checkout, no worktree, no commits made).
4+
5+
## Pass 1 — `cargo clippy -p ndarray -- -D warnings` (lib)
6+
7+
3 errors, all `clippy::question_mark` on the identical `match self.<field> { None => return None, Some(ref ix) => ix.clone() }` pattern inside `Iterator::next` impls. Fixed by collapsing to `self.<field>.clone()?`.
8+
9+
- `src/indexes.rs:60``IndicesIter::next``clippy::question_mark` — replaced 4-line match with `let index = self.index.clone()?;`
10+
- `src/iterators/mod.rs:491``IndexedIter::next``clippy::question_mark` — same fix, `self.0.inner.index.clone()?`
11+
- `src/iterators/mod.rs:667``IndexedIterMut::next``clippy::question_mark` — same fix, `self.0.inner.index.clone()?`
12+
13+
Re-run: clean (`Finished` in 13.88s).
14+
15+
## Pass 2 — `cargo clippy -p ndarray --tests -- -D warnings`
16+
17+
3 errors, all in `#[cfg(test)]` modules:
18+
19+
- `src/property_mask.rs:426``clippy::unusual_byte_groupings``0b11111_1000``0b1_1111_1000` (regrouped into nibbles per clippy's own suggestion; value unchanged, still asserting the same bit pattern).
20+
- `src/bitwise.rs:637``clippy::identity_op``assert_eq!(super::popcount_batch_u64(&words), 64 + 0 + 32)` had a no-op `+ 0`. Replaced with the literal `96` and kept the per-word breakdown as a comment (`// per-word contributions: 64 + 0 + 32`) so the documentational intent survives.
21+
- `src/palette_codec.rs:810``clippy::needless_range_loop` in `test_bedrock_pack_section``for i in 0..4096 { states[i] = (i % 4) as u16; }``for (i, state) in states.iter_mut().enumerate() { *state = (i % 4) as u16; }`. Purely mechanical (index only used for indexing + the `% 4` value); no semantic change.
22+
23+
Re-run: clean (`Finished` in 36.14s).
24+
25+
## Pass 3 — `cargo fmt -p ndarray`
26+
27+
Applied. Reformatted only the touched hunks (rustfmt collapsed the shortened `next()` bodies and normalized the byte-grouping/comment line spacing). No behavioural diff beyond formatting.
28+
29+
## Nothing skipped
30+
31+
No `src/simd_*.rs` files were touched — none of the flagged lints landed there. No `unsafe` blocks were touched (none of the fixes were near unsafe code). No public API signatures changed.
32+
33+
## Final status
34+
35+
- `cargo clippy -p ndarray -- -D warnings`**clean**
36+
- `cargo clippy -p ndarray --tests -- -D warnings`**clean**
37+
- `cargo fmt -p ndarray`**applied**, `git diff --stat`: 5 files changed, 8 insertions(+), 16 deletions(-)
38+
- No `cargo test` run (disk guard tripped — see below).
39+
40+
## Disk guard note
41+
42+
Free space on `/home/user` dropped from 5.7 GB → 5.3 GB → **4.2 GB** over the course of this run (crossing the 5 GB floor right after the `cargo fmt` invocation, which had itself been preceded by a compliant 5.3 GB check). Per the hard rule I stopped immediately after `cargo fmt` and did **not** run any further cargo invocations (no targeted `cargo test`, no additional clippy passes). All fixes above are comment/mechanical-only changes (`.clone()?` collapse, digit regrouping, literal substitution, `iter_mut().enumerate()`), so behavioural risk is low, but the orchestrator should re-run `cargo test -p ndarray` centrally once disk space is confirmed healthy.

.github/workflows/ci.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ env:
2121
# `LazyLock<Tier>` detection means one binary, all ISAs. Jobs that
2222
# specifically need a higher target-cpu can opt in via per-job env.
2323
RUSTFLAGS: "-D warnings"
24-
MSRV: 1.95.0
25-
BLAS_MSRV: 1.95.0
24+
MSRV: 1.97.1
25+
BLAS_MSRV: 1.97.1
2626

2727
jobs:
2828
pass-msrv:
@@ -41,18 +41,18 @@ jobs:
4141
runs-on: ubuntu-latest
4242
strategy:
4343
matrix:
44-
# Pinned to 1.95.0 to match `rust-toolchain.toml`. The workspace
45-
# bumped from 1.94.1 → 1.95.0 in commit
44+
# Pinned to 1.97.1 to match `rust-toolchain.toml`. The workspace
45+
# bumped from 1.94.1 → 1.97.1 in commit
4646
# https://github.com/AdaWorldAPI/ndarray (this PR) to align with
4747
# bevy (edition 2024 → 1.95 MSRV) and lance-graph. 1.95 added the
4848
# `clippy::manual_checked_ops` lint which fires on
4949
# `impl_owned_array.rs::into_scalar` — fixed in this same PR.
5050
rust:
51-
- "1.95.0"
51+
- "1.97.1"
5252
name: clippy/${{ matrix.rust }}
5353
steps:
5454
- uses: actions/checkout@v4
55-
- uses: dtolnay/rust-toolchain@1.95.0
55+
- uses: dtolnay/rust-toolchain@1.97.1
5656
with:
5757
components: clippy
5858
- uses: Swatinem/rust-cache@v2
@@ -74,10 +74,10 @@ jobs:
7474
# That state no longer exists; the band-aid is removed in this PR.
7575
steps:
7676
- uses: actions/checkout@v4
77-
# Stable rustfmt 1.95.0 — pinned in `rust-toolchain.toml`. No
77+
# Stable rustfmt 1.97.1 — pinned in `rust-toolchain.toml`. No
7878
# nightly dependency since rustfmt.toml is stable-clean post-PR
7979
# #133.
80-
- uses: dtolnay/rust-toolchain@1.95.0
80+
- uses: dtolnay/rust-toolchain@1.97.1
8181
with:
8282
components: rustfmt
8383
- run: cargo fmt --all --check
@@ -99,7 +99,7 @@ jobs:
9999
with:
100100
toolchain: ${{ matrix.rust }}
101101
targets: ${{ matrix.target }}
102-
# rust-toolchain.toml pins 1.95.0 — install the cross-compile target
102+
# rust-toolchain.toml pins 1.97.1 — install the cross-compile target
103103
# for that toolchain too, since dtolnay/rust-toolchain only installs
104104
# for the matrix value which may differ from the pinned version.
105105
- run: rustup target add ${{ matrix.target }}
@@ -126,7 +126,7 @@ jobs:
126126
- uses: dtolnay/rust-toolchain@stable
127127
with:
128128
targets: wasm32-unknown-unknown
129-
# rust-toolchain.toml pins 1.95.0 — install the wasm target for the pinned
129+
# rust-toolchain.toml pins 1.97.1 — install the wasm target for the pinned
130130
# toolchain too (dtolnay installs for `stable`, which may differ).
131131
- run: rustup target add wasm32-unknown-unknown
132132
- uses: actions/setup-node@v4
@@ -155,7 +155,7 @@ jobs:
155155
- uses: dtolnay/rust-toolchain@stable
156156
with:
157157
targets: aarch64-unknown-linux-gnu
158-
# rust-toolchain.toml pins 1.95.0 — install the aarch64 target for the
158+
# rust-toolchain.toml pins 1.97.1 — install the aarch64 target for the
159159
# pinned toolchain too (dtolnay installs for `stable`, which may differ).
160160
- run: rustup target add aarch64-unknown-linux-gnu
161161
- name: install aarch64 cross toolchain + qemu-user
@@ -210,7 +210,7 @@ jobs:
210210
name: hpc-stream-parallel/rayon
211211
steps:
212212
- uses: actions/checkout@v4
213-
- uses: dtolnay/rust-toolchain@1.95.0
213+
- uses: dtolnay/rust-toolchain@1.97.1
214214
- uses: Swatinem/rust-cache@v2
215215
- uses: taiki-e/install-action@nextest
216216
- name: cargo check (no rayon — scalar path unchanged)

Cargo.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33
name = "ndarray"
44
version = "0.17.2"
55
edition = "2021"
6-
rust-version = "1.95"
6+
# Matches `rust-toolchain.toml` (1.97.1) and CI's `MSRV` / `BLAS_MSRV` env, which
7+
# are ALREADY 1.97.1. This said 1.95 until 2026-08-05 — a declared MSRV that
8+
# nothing tested, because no CI job builds at 1.95. Consumers read this field:
9+
# tesseract-rs path-deps both ndarray and lance-graph-contract, and a 1.95 build
10+
# of the contract crate happens to still succeed today — a coincidence, not a
11+
# guarantee, and exactly what an untested MSRV declaration buys. Declare what is
12+
# actually verified.
13+
rust-version = "1.97"
714
authors = [
815
"Ulrik Sverdrup \"bluss\"",
916
"Jim Turner"

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ndarray — Railway compile-test image (AVX2 default)
22
# Verifies the HPC module builds cleanly (default + jit-native features)
3-
# Requires Rust 1.95.0 (LazyLock, simd_caps, modern std APIs)
3+
# Requires Rust 1.97.1 (LazyLock, simd_caps, modern std APIs)
44
#
55
# CPU detection & SIMD dispatch documentation: see Dockerfile.md
66
# AVX-512 pinned variant: see Dockerfile.avx512
@@ -15,17 +15,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1515
curl ca-certificates gcc libc6-dev pkg-config libssl-dev \
1616
&& rm -rf /var/lib/apt/lists/*
1717

18-
# Install Rust 1.95.0 via rustup — MUST match rust-toolchain.toml (channel =
19-
# "1.95.0") and Cargo.toml's `rust-version = "1.95"`. rust-toolchain.toml is
18+
# Install Rust 1.97.1 via rustup — MUST match rust-toolchain.toml (channel =
19+
# "1.97.1") and Cargo.toml's `rust-version = "1.97"`. rust-toolchain.toml is
2020
# deliberately NOT copied into the image (rustup would try to download a second
2121
# toolchain at build time), so this pin is the only thing keeping the image in
2222
# step with the repo — bump it whenever rust-toolchain.toml moves.
2323
ENV RUSTUP_HOME=/usr/local/rustup \
2424
CARGO_HOME=/usr/local/cargo \
2525
PATH=/usr/local/cargo/bin:$PATH
2626
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
27-
sh -s -- -y --default-toolchain 1.95.0 --profile minimal \
28-
&& rustc --version | grep -q "1.95.0"
27+
sh -s -- -y --default-toolchain 1.97.1 --profile minimal \
28+
&& rustc --version | grep -q "1.97.1"
2929

3030
WORKDIR /app
3131

@@ -76,4 +76,4 @@ RUN cargo test --release --lib -- hpc:: 2>&1 && echo "=== HPC TESTS OK ==="
7676
# Minimal runtime image — just proves it compiled
7777
FROM debian:bookworm-slim
7878
COPY --from=builder /app/target/release/libndarray.rlib /usr/local/lib/
79-
CMD ["echo", "ndarray build verified — Rust 1.95.0"]
79+
CMD ["echo", "ndarray build verified — Rust 1.97.1"]

Dockerfile.avx512

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ ENV RUSTUP_HOME=/usr/local/rustup \
2121
CARGO_HOME=/usr/local/cargo \
2222
PATH=/usr/local/cargo/bin:$PATH
2323
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
24-
sh -s -- -y --default-toolchain 1.95.0 --profile minimal \
25-
&& rustc --version | grep -q "1.95.0"
24+
sh -s -- -y --default-toolchain 1.97.1 --profile minimal \
25+
&& rustc --version | grep -q "1.97.1"
2626

2727
WORKDIR /app
2828

@@ -57,4 +57,4 @@ RUN cargo test --release --lib -- hpc:: 2>&1 && echo "=== AVX-512 HPC TESTS OK =
5757

5858
FROM debian:bookworm-slim
5959
COPY --from=builder /app/target/release/libndarray.rlib /usr/local/lib/
60-
CMD ["echo", "ndarray AVX-512 build verified — Rust 1.95.0, target-cpu=x86-64-v4"]
60+
CMD ["echo", "ndarray AVX-512 build verified — Rust 1.97.1, target-cpu=x86-64-v4"]

rust-toolchain.toml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
[toolchain]
2-
channel = "1.95.0"
3-
# Pinned to 1.95.0 (2026-04-14). Aligns ndarray with the rest of the
4-
# AdaWorldAPI stack: bevy (already on 1.95 for edition 2024) and
5-
# lance-graph (bumped in parallel). 1.95 introduced one new clippy lint
6-
# that fires on this codebase (`clippy::manual_checked_ops` on
7-
# `impl_owned_array.rs::into_scalar`); that's fixed in this same commit.
2+
channel = "1.97.1"
3+
# Pinned to 1.97.1 (2026-08-05). Aligns ndarray with the rest of the
4+
# AdaWorldAPI stack — lance-graph, OGAR, ruff, MedCare-rs, woa-rs, a2ui-rs and
5+
# stockfish-rs are all on 1.97.1; ndarray was the last sibling still declaring
6+
# 1.95, so a consumer path-dep'ing both it and lance-graph-contract saw two
7+
# different MSRVs.
8+
#
9+
# The channel here and `Cargo.toml`'s `rust-version` must move TOGETHER. They
10+
# were out of step between the 1.95 → 1.97.1 channel bump and 2026-08-05: this
11+
# file said 1.97.1 while the manifest still declared 1.95, and the comment below
12+
# still described the 1.95 rationale. A stale comment on a version pin is how the
13+
# next reader learns the wrong number.
14+
#
15+
# (Historical: the 1.95 bump introduced `clippy::manual_checked_ops`, which fired
16+
# on `impl_owned_array.rs::into_scalar` and was fixed in that same commit.)
817
# Never auto-track `stable` — bump explicitly when a future version is
918
# reviewed and the workspace clippy passes clean.
1019
components = ["clippy", "rustfmt"]

src/bitwise.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,8 @@ mod tests {
634634
#[test]
635635
fn test_popcount_batch_u64() {
636636
let words = [0xFFFFFFFFFFFFFFFFu64, 0, 0x0F0F0F0F0F0F0F0F];
637-
assert_eq!(super::popcount_batch_u64(&words), 64 + 0 + 32);
637+
// per-word contributions: 64 + 0 + 32
638+
assert_eq!(super::popcount_batch_u64(&words), 96);
638639
}
639640

640641
#[test]

src/indexes.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ where
5757
type Item = D::Pattern;
5858
#[inline]
5959
fn next(&mut self) -> Option<Self::Item> {
60-
let index = match self.index {
61-
None => return None,
62-
Some(ref ix) => ix.clone(),
63-
};
60+
let index = self.index.clone()?;
6461
self.index = self.dim.next_for(index.clone());
6562
Some(index.into_pattern())
6663
}

src/iterators/mod.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,7 @@ impl<'a, A, D: Dimension> Iterator for IndexedIter<'a, A, D> {
488488
type Item = (D::Pattern, &'a A);
489489
#[inline]
490490
fn next(&mut self) -> Option<Self::Item> {
491-
let index = match self.0.inner.index {
492-
None => return None,
493-
Some(ref ix) => ix.clone(),
494-
};
491+
let index = self.0.inner.index.clone()?;
495492
match self.0.next() {
496493
None => None,
497494
Some(elem) => Some((index.into_pattern(), elem)),
@@ -664,10 +661,7 @@ impl<'a, A, D: Dimension> Iterator for IndexedIterMut<'a, A, D> {
664661
type Item = (D::Pattern, &'a mut A);
665662
#[inline]
666663
fn next(&mut self) -> Option<Self::Item> {
667-
let index = match self.0.inner.index {
668-
None => return None,
669-
Some(ref ix) => ix.clone(),
670-
};
664+
let index = self.0.inner.index.clone()?;
671665
match self.0.next() {
672666
None => None,
673667
Some(elem) => Some((index.into_pattern(), elem)),

src/palette_codec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,8 @@ mod tests {
807807

808808
// Create states with a small palette
809809
let mut states = vec![0u16; 4096];
810-
for i in 0..4096 {
811-
states[i] = (i % 4) as u16;
810+
for (i, state) in states.iter_mut().enumerate() {
811+
*state = (i % 4) as u16;
812812
}
813813

814814
let mut palette = HashMap::new();

0 commit comments

Comments
 (0)