Modern Apps git

← Modern-Apps.git

vision: allow intentional reference operands in matrix tests

Commit
71a2e5d6a4e0baee4a1ab6c3d0d0dcd76c150830
Author
Vayun Mathur <[email protected]>
When
2026-12-01 21:54 UTC (4 days ago)
Parents
4164556
Workspace clippy flagged the &Matrix3 operands in
multiply_ref_variants_match_owned and matrix_times_vector as
needless borrows / op_ref. They are the subject of the tests: the
Mul impls for &Matrix3 operands in matrix3.rs exist precisely to
be exercised against the owned impl, and removing the references
would silently stop covering them.

Add per-test #[allow(clippy::needless_borrow, clippy::op_ref)]
with a comment saying so. No crate-level allows, assertions
unchanged.

Verified: cargo clippy -p vision_core --all-targets clean,
cargo test -p vision_core (84 passed), cargo fmt --check clean.

Diff

library/vision/src/main/rust/src/linalg/matrix3_tests.rs
diff --git a/library/vision/src/main/rust/src/linalg/matrix3_tests.rs b/library/vision/src/main/rust/src/linalg/matrix3_tests.rsindex d7fa81e173..299a1e996b 100644--- a/library/vision/src/main/rust/src/linalg/matrix3_tests.rs+++ b/library/vision/src/main/rust/src/linalg/matrix3_tests.rs@@ -62,6 +62,10 @@ fn multiply_hand_computed() {     mat_close(&(a * Matrix3::identity()), &[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]);     mat_close(&(Matrix3::zeros() * a), &[0.0; 9]); }+// The borrows are the subject of this test: the `Mul` impls for+// `&Matrix3` operands (matrix3.rs) must agree with the owned impl, so+// `needless_borrow`/`op_ref` are false positives here.+#[allow(clippy::needless_borrow, clippy::op_ref)] #[test] fn multiply_ref_variants_match_owned() {     let a = Matrix3::new(1.0, 0.0, 2.0, 0.0, 1.0, 0.0, 3.0, 0.0, 1.0);@@ -110,6 +114,9 @@ fn multiply_ref_variants_match_owned() {         ],     ); }+// `&m * Vector3` exercises the `Mul<Vector3> for &Matrix3` impl on+// purpose; see `multiply_ref_variants_match_owned`.+#[allow(clippy::needless_borrow, clippy::op_ref)] #[test] fn matrix_times_vector() {     let m = Matrix3::new(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0);