Skip to content

Commit bd3c65d

Browse files
committed
style: cargo fmt ueber clam.rs + clam_v3.rs
CI-Gate cargo fmt --all --check war rot — reine Formatierung, kein semantisches Byte geaendert; clam 96/96 danach unveraendert gruen.
1 parent 8c6e74d commit bd3c65d

2 files changed

Lines changed: 25 additions & 13 deletions

File tree

‎src/hpc/clam.rs‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,15 @@ impl ClamTree {
243243
/// The one construction core, parameterised over any callable. Both
244244
/// public arms land here.
245245
fn build_core(
246-
data: &[u8], vec_len: usize, count: usize, config: &BuildConfig,
247-
dist: &dyn Fn(&[u8], &[u8]) -> u64, carrier: TreeDistance,
246+
data: &[u8], vec_len: usize, count: usize, config: &BuildConfig, dist: &dyn Fn(&[u8], &[u8]) -> u64,
247+
carrier: TreeDistance,
248248
) -> Self {
249249
let tmp = Self::build_core_nodes(data, vec_len, count, config, dist);
250250
Self::assemble(tmp, carrier)
251251
}
252252

253253
fn build_core_nodes(
254-
data: &[u8], vec_len: usize, count: usize, config: &BuildConfig,
255-
dist: &dyn Fn(&[u8], &[u8]) -> u64,
254+
data: &[u8], vec_len: usize, count: usize, config: &BuildConfig, dist: &dyn Fn(&[u8], &[u8]) -> u64,
256255
) -> (Vec<Cluster>, Vec<usize>) {
257256
// Order and constants are the ORIGINAL build's, verbatim: assert
258257
// before the empty return, the 0xDEAD_BEEF_CAFE_BABE seed, the
@@ -3142,7 +3141,9 @@ mod tests {
31423141
fn arm_test_data() -> Vec<u8> {
31433142
// Deterministic, structured enough to force real splits.
31443143
let mut rng = SplitMix64::new(0x51_7EED);
3145-
(0..64 * 32).map(|_| (rng.next_u64() & 0xFF) as u8).collect()
3144+
(0..64 * 32)
3145+
.map(|_| (rng.next_u64() & 0xFF) as u8)
3146+
.collect()
31463147
}
31473148

31483149
fn assert_same_tree(a: &ClamTree, b: &ClamTree) {
@@ -3163,7 +3164,10 @@ mod tests {
31633164
#[test]
31643165
fn the_two_arms_build_the_identical_tree() {
31653166
let data = arm_test_data();
3166-
let cfg = BuildConfig { min_cardinality: 4, ..Default::default() };
3167+
let cfg = BuildConfig {
3168+
min_cardinality: 4,
3169+
..Default::default()
3170+
};
31673171
let ptr = ClamTree::build_with_fn(&data, 32, 64, &cfg, tail16_hamming);
31683172
let dy = ClamTree::build_with_distance(&data, 32, 64, &cfg, TailHamming { from: 16 });
31693173
assert_same_tree(&ptr, &dy);
@@ -3189,7 +3193,10 @@ mod tests {
31893193
}
31903194
}
31913195
let data = arm_test_data();
3192-
let cfg = BuildConfig { min_cardinality: 4, ..Default::default() };
3196+
let cfg = BuildConfig {
3197+
min_cardinality: 4,
3198+
..Default::default()
3199+
};
31933200
assert!(ClamTree::build_with_fn(&data, 32, 64, &cfg, hamming_inline).is_metric());
31943201
assert!(!ClamTree::build_with_distance(&data, 32, 64, &cfg, NotAMetric).is_metric());
31953202
}
@@ -3200,7 +3207,10 @@ mod tests {
32003207
#[should_panic(expected = "build_with_distance")]
32013208
fn the_fn_pointer_accessor_refuses_the_stateful_arm() {
32023209
let data = arm_test_data();
3203-
let cfg = BuildConfig { min_cardinality: 4, ..Default::default() };
3210+
let cfg = BuildConfig {
3211+
min_cardinality: 4,
3212+
..Default::default()
3213+
};
32043214
let t = ClamTree::build_with_distance(&data, 32, 64, &cfg, TailHamming { from: 0 });
32053215
let _ = t.distance_fn();
32063216
}

‎src/hpc/clam_v3.rs‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,7 @@ impl RailSpec {
155155
/// The same spec with a continuation register stacked at `at`.
156156
#[must_use]
157157
pub const fn stacked(self, at: usize) -> Self {
158-
Self {
159-
cont: Some(at),
160-
..self
161-
}
158+
Self { cont: Some(at), ..self }
162159
}
163160

164161
/// Maximum representable depth under this spec.
@@ -298,7 +295,12 @@ mod tests {
298295
fn row(levels: &[u8], axis: RailAxis, fill: u8) -> Vec<u8> {
299296
let mut r = vec![0u8; 512];
300297
for (i, &v) in levels.iter().enumerate().take(RAIL_PAIRS) {
301-
let at = 4 + 2 * i + match axis { RailAxis::Lo => 0, RailAxis::Hi => 1 };
298+
let at = 4
299+
+ 2 * i
300+
+ match axis {
301+
RailAxis::Lo => 0,
302+
RailAxis::Hi => 1,
303+
};
302304
r[at] = v;
303305
}
304306
for b in &mut r[V3_VALUE_OFF..] {

0 commit comments

Comments
 (0)