From d1d58850b3b3ccc6b3115ad8300ea3112bb27b48 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sat, 9 Nov 2024 09:51:07 +0100 Subject: [PATCH] chore: use Default for cache object (#65) --- src/calculate/pass_3.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/calculate/pass_3.rs b/src/calculate/pass_3.rs index 7c7b8e9..3386752 100644 --- a/src/calculate/pass_3.rs +++ b/src/calculate/pass_3.rs @@ -17,6 +17,7 @@ const OPERATOR_HAS_PENALTY: [EffectOperator; 5] = [ pub struct PassThree {} +#[derive(Default)] struct Cache { hull: BTreeMap, char: BTreeMap, @@ -256,15 +257,7 @@ impl Item { impl Pass for PassThree { fn pass(info: &impl Info, ship: &mut Ship) { - let mut cache = Cache { - hull: BTreeMap::new(), - char: BTreeMap::new(), - structure: BTreeMap::new(), - target: BTreeMap::new(), - items: BTreeMap::new(), - charge: BTreeMap::new(), - skills: BTreeMap::new(), - }; + let mut cache = Cache::default(); ship.hull .calculate_values(info, ship, &mut cache, Object::Ship);