ml: clippy hygiene in nets docs and weight tests
- Commit
8701e7ed249075da4cb4aa881142d253ac08ded2- Author
- Vayun Mathur <[email protected]>
- When
- 2026-12-01 21:56 UTC (4 days ago)
- Parents
c18cca9
Workspace clippy flagged: a /// doc comment attached to an include! in nets/mod.rs (rustdoc generates nothing for macro invocations; it is now a plain comment), four unused imports (Id, Node, Quant, Recorded) in weights_graph_edge_tests, a needless mut on the entry closure in weights_tests, and an f32 literal with excessive precision in reference_ops_tests (0.761_594_16 -> 0.761_594_2; the assertion tolerance is 1e-3, eight orders above the change). Verified: cargo clippy -p modelrunner --all-targets clean, cargo test -p modelrunner (871 passed), fmt clean.
Diff
library/ml/src/main/rust/src/nets/mod.rs
diff --git a/library/ml/src/main/rust/src/nets/mod.rs b/library/ml/src/main/rust/src/nets/mod.rsindex 0a35213d11..d2e129e78f 100644--- a/library/ml/src/main/rust/src/nets/mod.rs+++ b/library/ml/src/main/rust/src/nets/mod.rs@@ -194,7 +194,7 @@ pub fn as_exported(dims: &[u32]) -> Vec<u32> { } } -/// Which compute pipeline an [`Op::Dispatch`] wants.+// Which compute pipeline an `Op::Dispatch` wants. include!("mod_kind.rs"); #[cfg(test)] #[path = "builder_validation_tests.rs"]
library/ml/src/main/rust/src/nets/reference_ops_tests.rs
diff --git a/library/ml/src/main/rust/src/nets/reference_ops_tests.rs b/library/ml/src/main/rust/src/nets/reference_ops_tests.rsindex edd85645d6..17f67f5bc8 100644--- a/library/ml/src/main/rust/src/nets/reference_ops_tests.rs+++ b/library/ml/src/main/rust/src/nets/reference_ops_tests.rs@@ -54,7 +54,7 @@ fn mul_scalar_multiplies_by_the_weight_scalar() { fn softcap_is_cap_times_tanh_of_x_over_cap() { let out = one(Shape::new(1, 1, 3), &[0.0, 2.0, -20.0], &[], |b, x| b.softcap(x, 2.0)); // tanh(0)=0; tanh(1)=0.76159416; tanh(-10) saturates to -1.- close(&out, &[0.0, 2.0 * 0.761_594_16, -2.0]);+ close(&out, &[0.0, 2.0 * 0.761_594_2, -2.0]); } #[test]
library/ml/src/main/rust/src/weights_graph_edge_tests.rs
diff --git a/library/ml/src/main/rust/src/weights_graph_edge_tests.rs b/library/ml/src/main/rust/src/weights_graph_edge_tests.rsindex 4febff600a..4fea8e3c8e 100644--- a/library/ml/src/main/rust/src/weights_graph_edge_tests.rs+++ b/library/ml/src/main/rust/src/weights_graph_edge_tests.rs@@ -6,7 +6,7 @@ use super::{ TAG_LAYER_NORM, }; use crate::nets::tests::Shapes;-use crate::nets::{Act, Builder, Id, Node, Quant, Recorded, Shape};+use crate::nets::{Act, Builder, Shape}; fn section( nodes: &[(u8, Vec<u32>)],
library/ml/src/main/rust/src/weights_tests.rs
diff --git a/library/ml/src/main/rust/src/weights_tests.rs b/library/ml/src/main/rust/src/weights_tests.rsindex 957420f36a..f8a6e428bb 100644--- a/library/ml/src/main/rust/src/weights_tests.rs+++ b/library/ml/src/main/rust/src/weights_tests.rs@@ -132,7 +132,7 @@ fn quantised_file() -> Vec<u8> { out[12..16].copy_from_slice(&4u32.to_le_bytes()); out[48..52].copy_from_slice(&((HEADER_BYTES + 4 * 32) as u32).to_le_bytes()); out[52..56].copy_from_slice(&50u32.to_le_bytes());- let mut entry =+ let entry = |rank: u32, dims: [u32; 4], dtype: u32, offset: u32, len: u32, out: &mut Vec<u8>| { out.extend_from_slice(&rank.to_le_bytes()); for d in dims {