remove panic from SteppedVector
This commit is contained in:
parent
c2af28466c
commit
46e8d02cd7
@ -47,10 +47,9 @@ impl SteppedVector {
|
|||||||
// Should work....
|
// Should work....
|
||||||
let possible_i = ((x + self.min) / self.step) as usize;
|
let possible_i = ((x + self.min) / self.step) as usize;
|
||||||
if self.data[possible_i] == x {
|
if self.data[possible_i] == x {
|
||||||
return Some(possible_i);
|
Some(possible_i)
|
||||||
} else if (x >= self.min) && (self.max >= x) {
|
} else {
|
||||||
panic!("possible_i did not result in a possible value, but x is in range");
|
None
|
||||||
// Panic in case (no clue how this would happen). I may remove this check later.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not really needed as the above code should handle everything
|
// Not really needed as the above code should handle everything
|
||||||
@ -62,8 +61,8 @@ impl SteppedVector {
|
|||||||
return Some(i);
|
return Some(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
None
|
None
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user