Skip to content

Commit

Permalink
Merge pull request #181 from yihuang/patch-1
Browse files Browse the repository at this point in the history
Use mem::take to replace clone+clear
  • Loading branch information
bvssvni committed Sep 1, 2020
2 parents 14a2afd + cd28568 commit fa3dcd6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scene.rs
@@ -1,4 +1,5 @@
use std::collections::{HashSet,HashMap};
use std::mem;
use uuid::Uuid;

use graphics::{ Graphics, ImageSize };
Expand Down Expand Up @@ -42,8 +43,7 @@ impl<I: ImageSize> Scene<I> {
/// Update animation's state
pub fn event<E>(&mut self, e: &E) where E: GenericEvent {
// regenerate the animations and their states
let running = self.running.clone();
self.running.clear();
let running = mem::take(&mut self.running);

for (id, animations) in running.into_iter() {
let mut new_animations = Vec::new();
Expand Down

0 comments on commit fa3dcd6

Please sign in to comment.