diff --git a/examples/conway/src/main.rs b/examples/conway/src/main.rs index bc51519f..68b16b66 100644 --- a/examples/conway/src/main.rs +++ b/examples/conway/src/main.rs @@ -334,14 +334,9 @@ impl ConwayGrid { } fn grid_idx>(&self, x: I, y: I) -> Option { - if let (Ok(x), Ok(y)) = (x.try_into(), y.try_into()) { - if x < self.width && y < self.height { - Some(x + y * self.width) - } else { - None - } - } else { - None + match (x.try_into(), y.try_into()) { + (Ok(x), Ok(y)) if x < self.width && y < self.height => Some(x + y * self.width), + _ => None, } } }