Skip to content

Commit c569391

Browse files
blussjturner314
andcommitted
API: Name and comment changes for remove_index
Co-authored-by: Jim Turner <github@turner.link>
1 parent e792370 commit c569391

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/impl_methods.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,15 +2449,15 @@ where
24492449
/// Decreases the length of `axis` by one.
24502450
///
24512451
/// ***Panics** if `axis` or `index` is out of bounds.
2452-
pub fn shift_remove_index(&mut self, axis: Axis, index: usize)
2452+
pub fn remove_index(&mut self, axis: Axis, index: usize)
24532453
where
24542454
S: DataOwned + DataMut,
24552455
{
2456-
// TODO: It's possible to choose to shift the elment to the front or the back here,
2456+
// TODO: It's possible to choose to shift the element to the front or the back here,
24572457
// whichever is closer.
24582458
let (_, mut tail) = self.view_mut().split_at(axis, index);
2459-
// shift elements to the back
2460-
// use swap to keep all elements initialized (as required by owned storage)
2459+
// shift elements to the front
2460+
// use swapping to keep all elements initialized (as required by owned storage)
24612461
Zip::from(tail.lanes_mut(axis)).for_each(|mut lane| {
24622462
let mut lane_iter = lane.iter_mut();
24632463
let mut dst = if let Some(dst) = lane_iter.next() { dst } else { return };

tests/array.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,13 +2399,13 @@ mod array_cow_tests {
23992399
}
24002400

24012401
#[test]
2402-
fn test_shift_remove() {
2402+
fn test_remove_index() {
24032403
let mut a = arr2(&[[1, 2, 3],
24042404
[4, 5, 6],
24052405
[7, 8, 9],
24062406
[10,11,12]]);
2407-
a.shift_remove_index(Axis(0), 1);
2408-
a.shift_remove_index(Axis(1), 2);
2407+
a.remove_index(Axis(0), 1);
2408+
a.remove_index(Axis(1), 2);
24092409
assert_eq!(a.shape(), &[3, 2]);
24102410
assert_eq!(a,
24112411
array![[1, 2],
@@ -2417,22 +2417,22 @@ fn test_shift_remove() {
24172417
[7, 8, 9],
24182418
[10,11,12]]);
24192419
a.invert_axis(Axis(0));
2420-
a.shift_remove_index(Axis(0), 1);
2421-
a.shift_remove_index(Axis(1), 2);
2420+
a.remove_index(Axis(0), 1);
2421+
a.remove_index(Axis(1), 2);
24222422
assert_eq!(a.shape(), &[3, 2]);
24232423
assert_eq!(a,
24242424
array![[10,11],
24252425
[4, 5],
24262426
[1, 2]]);
24272427

2428-
a.shift_remove_index(Axis(1), 1);
2428+
a.remove_index(Axis(1), 1);
24292429

24302430
assert_eq!(a.shape(), &[3, 1]);
24312431
assert_eq!(a,
24322432
array![[10],
24332433
[4],
24342434
[1]]);
2435-
a.shift_remove_index(Axis(1), 0);
2435+
a.remove_index(Axis(1), 0);
24362436
assert_eq!(a.shape(), &[3, 0]);
24372437
assert_eq!(a,
24382438
array![[],

0 commit comments

Comments
 (0)