use mem::replace where it is needed

This commit is contained in:
Quaternions 2024-07-30 19:36:03 -07:00
parent 3268d92d24
commit 8cade8134f

View File

@ -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);