diff --git a/day_07/src/equation/operator_set.rs b/day_07/src/equation/operator_set.rs index 1b8af5b..307af72 100644 --- a/day_07/src/equation/operator_set.rs +++ b/day_07/src/equation/operator_set.rs @@ -60,11 +60,12 @@ fn create_permutations_recurse( } pub fn create_permutations(set: HashSet, len: usize) -> HashSet> { - if let Some(cached_value) = check_operator_set_cache(&PermutationCacheKey::new(len, &set)) { + let cache_key = PermutationCacheKey::new(len, &set); + if let Some(cached_value) = check_operator_set_cache(&cache_key) { return cached_value; } let mut permutations = HashSet::new(); create_permutations_recurse(&set, len, &mut permutations, vec![]); - store_operator_set_in_cache(PermutationCacheKey::new(len, &set), permutations.clone()); + store_operator_set_in_cache(cache_key, permutations.clone()); permutations }