Skip to content

Commit 2a8a3b0

Browse files
author
LukeMathWalker
committed
Simplify element access
1 parent b535f28 commit 2a8a3b0

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/arrayformat.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ fn get_highest_axis_to_skip(overflow_axes: &Vec<usize>,
3131
index: &[Ix],
3232
limit: &usize) -> Option<usize> {
3333
overflow_axes.iter()
34-
.filter(|axis| {
35-
if **axis == shape.len() - 1 {
34+
.filter(|&axis| {
35+
if *axis == shape.len() - 1 {
3636
return false
3737
};
38-
let sa_idx_max = shape.iter().skip(**axis).next().unwrap();
39-
let sa_idx_val = index.iter().skip(**axis).next().unwrap();
40-
sa_idx_val >= limit && sa_idx_val < &(sa_idx_max - limit)
38+
let sa_idx_max = shape[*axis];
39+
let sa_idx_val = index[*axis];
40+
sa_idx_val >= *limit && sa_idx_val < sa_idx_max - *limit
4141
})
4242
.min()
4343
.map(|v| *v)

0 commit comments

Comments
 (0)