Skip to content

Commit 2505de3

Browse files
committed
refactor(07/2015): parse input only once
1 parent a2a6984 commit 2505de3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/solutions/year2015/day07.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ impl Solution for Day07 {
1212
}
1313

1414
fn part_two(&self, input: &str) -> String {
15-
let a_value = self.signal(input, "a");
15+
let instructions = self.parse(input);
16+
let a_value = self.signal_for_instructions(&instructions.clone(), "a");
1617

17-
let mut instructions = self.parse(input);
18+
let mut instructions = instructions;
1819
instructions
1920
.entry("b".to_string())
2021
.and_modify(|v| *v = Instruction::Value(Value::Numeric(a_value.parse().unwrap())));

0 commit comments

Comments
 (0)