From 8cade8134f173689dda7d3b3fe47248d66650a6b Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 30 Jul 2024 19:36:03 -0700 Subject: [PATCH] use mem::replace where it is needed --- src/physics.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/physics.rs b/src/physics.rs index 3f4fbd8..2cbccb0 100644 --- a/src/physics.rs +++ b/src/physics.rs @@ -104,7 +104,8 @@ impl InputState{ &self.next_mouse } fn set_next_mouse(&mut self,next_mouse:MouseState){ - (self.next_mouse,self.mouse)=(next_mouse,self.next_mouse.clone()); + //I like your functions magic language + self.mouse=std::mem::replace(&mut self.next_mouse,next_mouse); } fn replace_mouse(&mut self,mouse:MouseState,next_mouse:MouseState){ (self.next_mouse,self.mouse)=(next_mouse,mouse);