From 46e519822f4a97498cf54ed5ef235bc39a973611 Mon Sep 17 00:00:00 2001 From: DylanCavers Date: Tue, 1 Oct 2024 21:44:32 +0100 Subject: [PATCH] small changes --- lib/state_machine/src/state_machine.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/state_machine/src/state_machine.rs b/lib/state_machine/src/state_machine.rs index 293fe9e..45e0dde 100644 --- a/lib/state_machine/src/state_machine.rs +++ b/lib/state_machine/src/state_machine.rs @@ -17,12 +17,11 @@ impl StateMachine { pub fn handle_transition(&mut self, to_state: &State) { let to_from_state = SourceAndTarget { - source: self.current_state.clone(), - target: to_state.clone(), + source: self.current_state, + target: *to_state, }; - match self.transition_map.get(&to_from_state) { - Some(&new_state) => self.current_state = new_state, - None => (), + if let Some(&new_state) = self.transition_map.get(&to_from_state) { + self.current_state = new_state; } }