refactor(linalg): drop redundant PartialEq bound from block-sparse test helpers - #462
Conversation
…st helpers `Sector` already requires `Eq` as a supertrait, and `Eq: PartialEq`, so `S: Sector + PartialEq` is exactly equivalent to `S: Sector`. Consolidate on `S: Sector` across the block-sparse test helpers so the signatures stop implying `PartialEq` is an extra requirement beyond `Sector`. Closes #461
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughTest helpers in block-sparse linear algebra modules now require only the ChangesSector bound refactor
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR refactors ariadnetor-linalg’s block-sparse test helpers to remove a redundant + PartialEq bound on S where S: Sector already implies PartialEq (via Eq).
Changes:
- Replaced
S: Sector + PartialEqwithS: Sectorin the block-sparse decomposition test helpers. - Replaced
S: Sector + PartialEqwithS: Sectorin theeigh/eigreconstruction helper tests. - Replaced
S: Sector + PartialEqwithS: Sectorin the block-sparse expm test helper (verify_expm) where-clause.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/ariadnetor-linalg/src/block_sparse_expm/tests.rs | Drops redundant PartialEq bound from verify_expm helper. |
| crates/ariadnetor-linalg/src/block_sparse_decomp/tests/mod.rs | Drops redundant PartialEq bound from multiple reconstruction/orthonormality helpers. |
| crates/ariadnetor-linalg/src/block_sparse_decomp/eigh/tests.rs | Drops redundant PartialEq bound from verify_reconstruction helper. |
| crates/ariadnetor-linalg/src/block_sparse_decomp/eig/tests.rs | Drops redundant PartialEq bound from verify_reconstruction helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Sectoris declaredpub trait Sector: Clone + Eq + Ord + Hash + Debug, and Rust std declaresEq: PartialEq<Self>, so anyS: Sectoralready entailsS: PartialEq. TheS: Sector + PartialEqbounds on the block-sparse test helpers therefore read as ifPartialEqwere an extra requirement beyondSector, which it is not. This consolidates them onS: Sector, a semantic no-op that keeps the helper signatures honest about what they require.Closes #461
Changes
Replace
S: Sector + PartialEqwithS: Sectorat all seven block-sparse test helpers:block_sparse_decomp/tests/mod.rs—verify_svd_reconstruction,verify_two_factor_reconstruction,assert_orthonormal_columns,assert_orthonormal_rowsblock_sparse_decomp/eigh/tests.rs—verify_reconstructionblock_sparse_decomp/eig/tests.rs—verify_reconstructionblock_sparse_expm/tests.rs— theverify_expmwhere-clause boundTest plan
cargo test -p ariadnetor-linalg: 491 passed, 0 failed.cargo make clippy(denies warnings, covers all test targets): clean.Sector + PartialEqbound remains inariadnetor-linalg.Summary by CodeRabbit