Skip to content

Commit

Permalink
Remove loops witch never loops fixes rust-ndarray#642
Browse files Browse the repository at this point in the history
  • Loading branch information
alex179ohm committed Jul 4, 2019
1 parent b1dc684 commit fdf984b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/dimension/dimension_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,8 @@ pub trait Dimension:
if self.slice().iter().all(|&d| d != 0) {
let mut it = strides.slice_mut().iter_mut().rev();
// Set first element to 1
while let Some(rs) = it.next() {
if let Some(rs) = it.next() {
*rs = 1;
break;
}
let mut cum_prod = 1;
for (rs, dim) in it.zip(self.slice().iter().rev()) {
Expand All @@ -156,9 +155,8 @@ pub trait Dimension:
if self.slice().iter().all(|&d| d != 0) {
let mut it = strides.slice_mut().iter_mut();
// Set first element to 1
while let Some(rs) = it.next() {
if let Some(rs) = it.next() {
*rs = 1;
break;
}
let mut cum_prod = 1;
for (rs, dim) in it.zip(self.slice()) {
Expand Down

0 comments on commit fdf984b

Please sign in to comment.