Skip to content

Commit 8835b67

Browse files
committed
Deprecate remove_axis
1 parent 5080e53 commit 8835b67

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/impl_methods.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,14 @@ impl<A, S, D> ArrayBase<S, D> where S: Data<Elem=A>, D: Dimension
621621
D: RemoveAxis,
622622
{
623623
self.collapse_axis(axis, index);
624-
self.remove_axis(axis)
624+
let dim = self.dim.remove_axis(axis);
625+
let strides = self.strides.remove_axis(axis);
626+
ArrayBase {
627+
ptr: self.ptr,
628+
data: self.data,
629+
dim,
630+
strides,
631+
}
625632
}
626633

627634
/// Selects `index` along the axis, collapsing the axis into length one.
@@ -1586,18 +1593,11 @@ impl<A, S, D> ArrayBase<S, D> where S: Data<Elem=A>, D: Dimension
15861593
/// Remove array axis `axis` and return the result.
15871594
///
15881595
/// **Panics** if the axis is out of bounds or its length is zero.
1596+
#[deprecated(note="use `.index_axis_move(Axis(_), 0)` instead", since="0.12.1")]
15891597
pub fn remove_axis(self, axis: Axis) -> ArrayBase<S, D::Smaller>
15901598
where D: RemoveAxis,
15911599
{
1592-
assert_ne!(self.len_of(axis), 0, "Length of removed axis must be nonzero.");
1593-
let d = self.dim.remove_axis(axis);
1594-
let s = self.strides.remove_axis(axis);
1595-
ArrayBase {
1596-
ptr: self.ptr,
1597-
data: self.data,
1598-
dim: d,
1599-
strides: s,
1600-
}
1600+
self.index_axis_move(axis, 0)
16011601
}
16021602

16031603
fn pointer_is_inbounds(&self) -> bool {

0 commit comments

Comments
 (0)