diff options
author | metamuffin <metamuffin@disroot.org> | 2024-07-18 15:52:12 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-07-18 15:52:12 +0200 |
commit | 1bff001db2914e8ee7bc331a4104592ad6e2e9a3 (patch) | |
tree | 28b12471e0dc905a8135123df8ddf400c24ed8b2 /server/src/interaction.rs | |
parent | 1dd3f549debdffd85639d74248a12dd884c5a59b (diff) | |
download | hurrycurry-1bff001db2914e8ee7bc331a4104592ad6e2e9a3.tar hurrycurry-1bff001db2914e8ee7bc331a4104592ad6e2e9a3.tar.bz2 hurrycurry-1bff001db2914e8ee7bc331a4104592ad6e2e9a3.tar.zst |
clippy
Diffstat (limited to 'server/src/interaction.rs')
-rw-r--r-- | server/src/interaction.rs | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/server/src/interaction.rs b/server/src/interaction.rs index b3f6af8c..2f6c940a 100644 --- a/server/src/interaction.rs +++ b/server/src/interaction.rs @@ -80,20 +80,14 @@ impl Recipe { match self { Recipe::Passive { input, .. } => vec![*input], Recipe::Active { input, .. } => vec![*input], - Recipe::Instant { inputs, .. } => { - inputs.into_iter().flat_map(|e| e.to_owned()).collect() - } + Recipe::Instant { inputs, .. } => inputs.iter().flat_map(|e| e.to_owned()).collect(), } } pub fn outputs(&self) -> Vec<ItemIndex> { match self { - Recipe::Passive { output, .. } => output.to_owned().into_iter().collect(), - Recipe::Active { outputs, .. } => { - outputs.into_iter().flat_map(|e| e.to_owned()).collect() - } - Recipe::Instant { outputs, .. } => { - outputs.into_iter().flat_map(|e| e.to_owned()).collect() - } + Recipe::Passive { output, .. } => output.iter().copied().collect(), + Recipe::Active { outputs, .. } => outputs.iter().flat_map(|e| e.to_owned()).collect(), + Recipe::Instant { outputs, .. } => outputs.iter().flat_map(|e| e.to_owned()).collect(), } } pub fn supports_tile(&self, tile: Option<TileIndex>) -> bool { @@ -161,15 +155,13 @@ pub fn interact( Recipe::Active { input, .. } => { if other.is_none() { if let Some(item) = this { - if item.kind == *input { - if item.active.is_none() { - info!("start active recipe {ri:?}"); - item.active = Some(Involvement { - recipe: ri, - working: 1, - progress: 0., - }); - } + if item.kind == *input && item.active.is_none() { + info!("start active recipe {ri:?}"); + item.active = Some(Involvement { + recipe: ri, + working: 1, + progress: 0., + }); } } } |