use chain.get instead of Some

This commit is contained in:
Simon Gardling 2025-02-21 10:50:31 -05:00
parent 0cc4c3bf92
commit 6e1e8dac11
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -356,8 +356,7 @@ impl Board {
for (idx, &(new_i, new_j)) in chain.into_iter().enumerate() {
let piece = self.get(new_i, new_j)?;
if piece == starting_color {
// SAFETY! get_unchecked is fine here because it's an index of itself, it's fine
return Some(unsafe { chain.get_unchecked(..idx) });
return chain.get(..idx);
}
}
None