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/src/entity/tutorial.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/src/entity/tutorial.rs')
-rw-r--r-- | server/src/entity/tutorial.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/server/src/entity/tutorial.rs b/server/src/entity/tutorial.rs index 60b32c79..44244862 100644 --- a/server/src/entity/tutorial.rs +++ b/server/src/entity/tutorial.rs @@ -144,7 +144,7 @@ impl StepContext<'_> { .game .players .get(&self.player) - .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 find_demand(&self, item: ItemIndex) -> Option<IVec2> { self.ent @@ -171,7 +171,7 @@ impl StepContext<'_> { .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) } fn find_tile(&self, tile: TileIndex) -> Option<IVec2> { @@ -195,9 +195,9 @@ impl StepContext<'_> { } fn prevent_burning(&self) -> Result<(), (Option<IVec2>, Message)> { if let Some((pos, tile)) = self.ent.game.tiles.iter().find(|(_, t)| { - t.item.as_ref().map_or(false, |t| { - t.active.as_ref().map_or(false, |i| i.warn && i.speed > 0.) - }) + t.item + .as_ref() + .is_some_and(|t| t.active.as_ref().is_some_and(|i| i.warn && i.speed > 0.)) }) { Err(( Some(*pos), @@ -228,7 +228,7 @@ impl StepContext<'_> { .game .players .get(&self.player) - .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)) { if let Some(pos) = self.find_demand(item) { Err((Some(pos), trm!("s.tutorial.serve"))) |