From 464ebd6fa686d32a16aaa6bd27d8f445caa42f6a Mon Sep 17 00:00:00 2001 From: metamuffin Date: Mon, 23 Dec 2024 12:41:15 +0100 Subject: clippy: mostly map_or replaced with is_some_and --- server/src/entity/tutorial.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'server/src/entity/tutorial.rs') 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 { 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 { @@ -195,9 +195,9 @@ impl StepContext<'_> { } fn prevent_burning(&self) -> Result<(), (Option, 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"))) -- cgit v1.2.3-70-g09d2