From 7de0becc0d03a407f22f06074652d7e1a329d087 Mon Sep 17 00:00:00 2001 From: Monty Marz Date: Tue, 20 Apr 2021 02:45:33 +0200 Subject: [PATCH] clippy --- client/src/lib.rs | 5 +++-- voxygen/src/hud/crafting.rs | 21 ++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/client/src/lib.rs b/client/src/lib.rs index 805b5b1bda..afb0cd5a9e 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -993,9 +993,10 @@ impl Client { recipe: &str, craft_sprite: Option<(Vec3, SpriteKind)>, ) -> bool { - if self.can_craft_recipe(recipe).map_or(false, |cs| { + let can_craft = self.can_craft_recipe(recipe).map_or(false, |cs| { cs.map_or(true, |cs| Some(cs) == craft_sprite.map(|(_, s)| s)) - }) { + }); + if can_craft { self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryEvent( InventoryEvent::CraftRecipe { recipe: recipe.to_string(), diff --git a/voxygen/src/hud/crafting.rs b/voxygen/src/hud/crafting.rs index dac34d463c..057e5141d0 100644 --- a/voxygen/src/hud/crafting.rs +++ b/voxygen/src/hud/crafting.rs @@ -438,23 +438,22 @@ impl<'a> Widget for Crafting<'a> { .unwrap_or(false) }) }); - let state = - if self - .client + let show_craft_sprite = + self.client .available_recipes() .get(name.as_str()) .map_or(false, |cs| { cs.map_or(true, |cs| { Some(cs) == self.show.craft_sprite.map(|(_, s)| s) }) - }) - { - RecipeIngredientQuantity::All - } else if at_least_some_ingredients { - RecipeIngredientQuantity::Some - } else { - RecipeIngredientQuantity::None - }; + }); + let state = if show_craft_sprite { + RecipeIngredientQuantity::All + } else if at_least_some_ingredients { + RecipeIngredientQuantity::Some + } else { + RecipeIngredientQuantity::None + }; (name, recipe, state) }) .collect();