From da2a8f5bfcba4dd6304e3506b695f1b5d45164fb Mon Sep 17 00:00:00 2001 From: Victoria Fischer Date: Sat, 14 Dec 2024 14:46:16 +0100 Subject: [PATCH] task: remove a copy operation --- src/task.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/task.rs b/src/task.rs index 591d711..802f59a 100644 --- a/src/task.rs +++ b/src/task.rs @@ -42,18 +42,18 @@ impl ScheduledTask { } fn start(&mut self) { - self.state = match self.state { - ScheduledState::Stopped => ScheduledState::Start, - ScheduledState::Stop => ScheduledState::Running, - _ => self.state + match self.state { + ScheduledState::Stopped => self.state = ScheduledState::Start, + ScheduledState::Stop => self.state = ScheduledState::Running, + _ => () } } fn stop(&mut self) { - self.state = match self.state { - ScheduledState::Running => ScheduledState::Stop, - ScheduledState::Start => ScheduledState::Stopped, - _ => self.state + match self.state { + ScheduledState::Running => self.state = ScheduledState::Stop, + ScheduledState::Start => self.state = ScheduledState::Stopped, + _ => () } }