diff options
author | metamuffin <metamuffin@disroot.org> | 2024-12-23 12:41:15 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-12-23 12:41:15 +0100 |
commit | 464ebd6fa686d32a16aaa6bd27d8f445caa42f6a (patch) | |
tree | 22587801553e44c6d707ca1fac8f3da864ed6ea8 /server/bot/src/algos/simple.rs | |
parent | 6ddb571e02dc04b1125669135eab5731523e8f73 (diff) | |
download | hurrycurry-464ebd6fa686d32a16aaa6bd27d8f445caa42f6a.tar hurrycurry-464ebd6fa686d32a16aaa6bd27d8f445caa42f6a.tar.bz2 hurrycurry-464ebd6fa686d32a16aaa6bd27d8f445caa42f6a.tar.zst |
clippy: mostly map_or replaced with is_some_and
Diffstat (limited to 'server/bot/src/algos/simple.rs')
-rw-r--r-- | server/bot/src/algos/simple.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/server/bot/src/algos/simple.rs b/server/bot/src/algos/simple.rs index b275b522..14eb38c4 100644 --- a/server/bot/src/algos/simple.rs +++ b/server/bot/src/algos/simple.rs @@ -109,7 +109,7 @@ impl<S> Context<'_, S> { self.game .players .get(&self.me) - .map_or(false, |p| p.item.as_ref().map_or(false, |i| i.kind == item)) + .is_some_and(|p| p.item.as_ref().is_some_and(|i| i.kind == item)) } pub fn is_hand_occupied(&self) -> bool { self.game @@ -131,7 +131,7 @@ impl<S> Context<'_, S> { self.game .tiles .get(&(pos + *off)) - .map_or(false, |t| self.game.data.tile_interact[t.kind.0]) + .is_some_and(|t| self.game.data.tile_interact[t.kind.0]) }) .map(|off| pos + off) .map(|pos| (*item, pos)) @@ -155,7 +155,7 @@ impl<S> Context<'_, S> { self.game .tiles .get(&(pos + *off)) - .map_or(false, |t| self.game.data.tile_interact[t.kind.0]) + .is_some_and(|t| self.game.data.tile_interact[t.kind.0]) }) .map(|off| pos + off) .map(|pos| (*item, pos)) @@ -177,7 +177,7 @@ impl<S> Context<'_, S> { self.game .tiles .iter() - .find(|(_, t)| t.item.as_ref().map_or(false, |t| t.kind == item)) + .find(|(_, t)| t.item.as_ref().is_some_and(|t| t.kind == item)) .map(|(p, _)| *p) } pub fn find_tile(&self, tile: TileIndex) -> Option<IVec2> { |