From 78b4fb6833dbf936fdf2cecca545f0561e22429f Mon Sep 17 00:00:00 2001 From: mhsn Date: Mon, 2 Jun 2025 16:57:21 +0000 Subject: rust lib: remove dangerous unwrap --- lib/rust/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rust/src/lib.rs b/lib/rust/src/lib.rs index bfeaee4..246a89f 100644 --- a/lib/rust/src/lib.rs +++ b/lib/rust/src/lib.rs @@ -18,8 +18,8 @@ impl Grid { (0..) .map(move |n| { self.grid - .get(usize::try_from(y + n * dy).unwrap()) - .and_then(|row| row.get(usize::try_from(x + n * dx).unwrap())) + .get(usize::try_from(y + n * dy).ok()?) + .and_then(|row| row.get(usize::try_from(x + n * dx).ok()?)) }) .take_while(Option::is_some) .flatten() -- cgit v1.2.3