fix unnecessary unwrap

This commit is contained in:
Simon Gardling 2022-02-28 11:39:45 -05:00
parent 35e1d5c016
commit 859603d530

View File

@ -182,10 +182,10 @@ impl Function {
(1..=self.pixel_width)
.map(|x| (x as f64 / resolution as f64) + min_x)
.map(|x| {
let i = x_data.iter().position(|&r| r == x);
let i_option = x_data.iter().position(|&r| r == x);
if i.is_some() {
back_cache[i.unwrap()]
if let Some(i) = i_option {
back_cache[i]
} else {
Value::new(x, self.run_func(x))
}