From 971dee36fdba35a4d38b210cf3fdac6ab824e338 Mon Sep 17 00:00:00 2001 From: Jonathan Krebs Date: Wed, 20 Nov 2024 13:05:11 +0100 Subject: [PATCH] fix warnings: replace some mem::replace with assignments --- bffhd/initiators/dummy.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/bffhd/initiators/dummy.rs b/bffhd/initiators/dummy.rs index c002e7e..2cfd502 100644 --- a/bffhd/initiators/dummy.rs +++ b/bffhd/initiators/dummy.rs @@ -10,7 +10,6 @@ use futures_util::future::BoxFuture; use futures_util::ready; use std::collections::HashMap; use std::future::Future; -use std::mem; use std::pin::Pin; use std::task::{Context, Poll}; use std::time::{Duration, Instant}; @@ -62,10 +61,7 @@ impl Future for Dummy { match &mut self.state { DummyState::Empty => { tracing::trace!("Dummy initiator is empty, initializing…"); - mem::replace( - &mut self.state, - DummyState::Sleeping(Self::timer(), Some(Status::Free)), - ); + self.state = DummyState::Sleeping(Self::timer(), Some(Status::Free)); } DummyState::Sleeping(timer, next) => { tracing::trace!("Sleep timer exists, polling it."); @@ -76,7 +72,7 @@ impl Future for Dummy { let status = next.take().unwrap(); let f = self.flip(status); - mem::replace(&mut self.state, DummyState::Updating(f)); + self.state = DummyState::Updating(f); } DummyState::Updating(f) => { tracing::trace!("Update future exists, polling it ."); @@ -85,10 +81,7 @@ impl Future for Dummy { tracing::trace!("Update future completed, sleeping!"); - mem::replace( - &mut self.state, - DummyState::Sleeping(Self::timer(), Some(next)), - ); + self.state = DummyState::Sleeping(Self::timer(), Some(next)); } } }