Skip to content

Commit a0df066

Browse files
format nightly
1 parent 8f72117 commit a0df066

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/impl_methods.rs

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3228,33 +3228,34 @@ impl<A, D: Dimension> ArrayRef<A, D>
32283228
}
32293229

32303230
let mut result = self.to_owned();
3231-
3231+
32323232
// Check if the first lane is contiguous
3233-
let is_contiguous = result.lanes_mut(axis)
3233+
let is_contiguous = result
3234+
.lanes_mut(axis)
32343235
.into_iter()
32353236
.next()
32363237
.map(|lane| lane.is_contiguous())
32373238
.unwrap_or(false);
3238-
3239+
32393240
if is_contiguous {
32403241
Zip::from(result.lanes_mut(axis)).for_each(|mut lane| {
32413242
lane.as_slice_mut().unwrap().select_nth_unstable(kth);
32423243
});
32433244
} else {
32443245
let mut temp_vec = Vec::with_capacity(axis_len);
3245-
3246+
32463247
Zip::from(result.lanes_mut(axis)).for_each(|mut lane| {
32473248
temp_vec.clear();
32483249
temp_vec.extend(lane.iter().cloned());
3249-
3250+
32503251
temp_vec.select_nth_unstable(kth);
3251-
3252+
32523253
Zip::from(&mut lane).and(&temp_vec).for_each(|dest, src| {
32533254
*dest = src.clone();
32543255
});
32553256
});
32563257
}
3257-
3258+
32583259
result
32593260
}
32603261
}
@@ -3352,7 +3353,8 @@ mod tests
33523353
}
33533354

33543355
#[test]
3355-
fn test_partition_1d() {
3356+
fn test_partition_1d()
3357+
{
33563358
// Test partitioning a 1D array
33573359
let array = arr1(&[3, 1, 4, 1, 5, 9, 2, 6]);
33583360
let result = array.partition(3, Axis(0));
@@ -3362,17 +3364,18 @@ mod tests
33623364
}
33633365

33643366
#[test]
3365-
fn test_partition_2d() {
3367+
fn test_partition_2d()
3368+
{
33663369
// Test partitioning a 2D array along both axes
33673370
let array = arr2(&[[3, 1, 4], [1, 5, 9], [2, 6, 5]]);
3368-
3371+
33693372
// Partition along axis 0 (rows)
33703373
let result0 = array.partition(1, Axis(0));
33713374
// After partitioning along axis 0, each column should have its middle element in the correct position
33723375
assert!(result0[[0, 0]] <= result0[[1, 0]] && result0[[2, 0]] >= result0[[1, 0]]);
33733376
assert!(result0[[0, 1]] <= result0[[1, 1]] && result0[[2, 1]] >= result0[[1, 1]]);
33743377
assert!(result0[[0, 2]] <= result0[[1, 2]] && result0[[2, 2]] >= result0[[1, 2]]);
3375-
3378+
33763379
// Partition along axis 1 (columns)
33773380
let result1 = array.partition(1, Axis(1));
33783381
// After partitioning along axis 1, each row should have its middle element in the correct position
@@ -3382,10 +3385,11 @@ mod tests
33823385
}
33833386

33843387
#[test]
3385-
fn test_partition_3d() {
3388+
fn test_partition_3d()
3389+
{
33863390
// Test partitioning a 3D array
33873391
let array = arr3(&[[[3, 1], [4, 1]], [[5, 9], [2, 6]]]);
3388-
3392+
33893393
// Partition along axis 0
33903394
let result = array.partition(0, Axis(0));
33913395
// After partitioning, each 2x2 slice should have its first element in the correct position

0 commit comments

Comments
 (0)