diff --git a/src/day7/main.rs b/src/day7/main.rs index 483c438..988bbd2 100644 --- a/src/day7/main.rs +++ b/src/day7/main.rs @@ -94,9 +94,9 @@ impl From for ModedOpcode { let a = i % 1000 >= 100; let b = i % 10000 >= 1000; let c = i > 10000; - let modes = (Mode::from(a), Mode::from(b), Mode::from(c)).into(); + let modes = (Mode::from(a), Mode::from(b), Mode::from(c)); ModedOpcode { - modes: modes, + modes: Modes::from(modes), op: Opcode::from(code), } } @@ -132,7 +132,7 @@ impl From for Computer { * sign }) .collect(); - program.into() + Computer::from(program) } } @@ -160,7 +160,7 @@ impl Computer { fn clone_with_input(&self, input: Vec) -> Computer { let mut computer = self.clone(); - computer.inputs = input.into(); + computer.inputs = VecDeque::from(input); computer } @@ -195,8 +195,8 @@ impl Computer { fn step(&mut self) { let instruction = self.program[self.pos]; let instruction = ModedOpcode::from(instruction); - self.modes = (&instruction).into(); - let advance = match (&instruction).into() { + self.modes = Modes::from(&instruction); + let advance = match Opcode::from(&instruction) { Opcode::Add => self.add(), Opcode::Multiply => self.multiply(), Opcode::Input => self.input(),