Use mem::take instead of mem::replace in iced_graphics::Renderer

Thanks to @tarkah for pointing this out!
This commit is contained in:
Héctor Ramón Jiménez 2021-11-04 18:23:18 +07:00
parent 157a40a568
commit ef5a731e4b
No known key found for this signature in database
GPG key ID: 140CC052C94F138E

View file

@ -53,8 +53,7 @@ where
} }
fn with_layer(&mut self, bounds: Rectangle, f: impl FnOnce(&mut Self)) { fn with_layer(&mut self, bounds: Rectangle, f: impl FnOnce(&mut Self)) {
let current_primitives = let current_primitives = std::mem::take(&mut self.primitives);
std::mem::replace(&mut self.primitives, Vec::new());
f(self); f(self);
@ -74,8 +73,7 @@ where
translation: Vector, translation: Vector,
f: impl FnOnce(&mut Self), f: impl FnOnce(&mut Self),
) { ) {
let current_primitives = let current_primitives = std::mem::take(&mut self.primitives);
std::mem::replace(&mut self.primitives, Vec::new());
f(self); f(self);