Skip to content

Bump Rust edition to 2024 + adopt relative idioms #401

Description

@Mec-iS

I'm submitting a

  • improvement.

Summary

Bump the crate from Rust edition 2021 to edition 2024 and adopt relative modern idioms. Edition 2024 stabilized in Rust 1.85 (Feb 2025); the repo toolchain is 1.94+, so it builds locally and on CI.

Pre-migration audit (already performed, read-only)

The two edition-2024 hazards that usually bite hardest do not apply here:

  • No -> impl Trait returns (zero RPIT) → no return-position-impl-trait lifetime over-capture regression.
  • All dyn Trait already carry explicit + 'a lifetimes (e.g. Box<dyn ArrayView1<T> + 'a>) → no dyn-elision surprise.

Other hazards are clean or trivial:

  • unsafe: only 4 unsafe { } blocks in src/linalg/basic/matrix.rs (raw-pointer iterator_mut, already tracked by tech-debt: replace unsafe raw-pointer iterator_mut in DenseMatrix (basic/matrix.rs) with safe split_at_mut approach #368). No unsafe fn / unsafe impl, so unsafe_op_in_unsafe_fn (default-warn in 2024) doesn't fire. No #[no_mangle] / #[export_name] / #[link_section] (no unsafe-attr migration).
  • pub use re-exports of private modules (error::ReadingError, grid_search::…): at most unreachable_pub warnings; cargo fix --edition handles.
  • cfg(coverage) / cfg(tarpaulin): not referenced in source → the new unexpected_cfgs lint won't fire from our code.
  • MSRV: no rust-version declared today → edition 2024 implies MSRV ≥ 1.85. Impact is on downstream consumers of the published crate (fine for 0.x).

Plan (sub-issues below)

Sub-issue Scope
A. Edition flip cargo fix --edition --allow-dirty --allow-staged --all-features; set edition = "2024" in Cargo.toml; update AGENTS.md ("Rust 2021" → "Rust 2024"), README changelog line, CHANGELOG.md (breaking re: implied MSRV). Inspect the auto-fix diff before flipping the edition flag.
B. #[allow]#[expect] Migrate ~10 lint-suppression sites to #[expect(...)]: crate-root #![allow(...)] in lib.rs; #![allow(non_snake_case)] in cholesky.rs/svd.rs/lu.rs/auc.rs/mahalanobis.rs; #[allow(dead_code)] in distance/cosine.rs + lu.rs; #![allow(clippy::ptr_arg, clippy::needless_range_loop)] in cluster/mod.rs + cluster_helpers.rs; #![allow(clippy::wrong_self_convention)] in linalg/traits/mod.rs. Verify each lint actually fires#[expect] errors if a suppression goes stale; keep #[allow] wherever the lint currently doesn't fire.
C. Declare MSRV Add rust-version = "1.85" to Cargo.toml. Honest about the downstream breaking implication of edition 2024.
D. unsafe cleanup Tracked by #368 (linked as a sub-issue below, not duplicated). Replace the 4 unsafe { } blocks in src/linalg/basic/matrix.rs with safe split_at_mut. Ships as its own PR.

Execution

Do you want to work on this issue?

yes — staged PRs target development.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrustPull requests that update rust code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions