summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-11-04 18:23:18 +0700
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2021-11-04 18:24:13 +0700
commitef5a731e4bd17f763b1697c7f0ac595928e91e58 (patch)
tree05aafab81057c4de3ae186218f5a9193bb701089 /graphics
parent157a40a56882ec1959034fa499b383e7f633aaf8 (diff)
downloadiced-ef5a731e4bd17f763b1697c7f0ac595928e91e58.tar.gz
iced-ef5a731e4bd17f763b1697c7f0ac595928e91e58.tar.bz2
iced-ef5a731e4bd17f763b1697c7f0ac595928e91e58.zip
Use `mem::take` instead of `mem::replace` in `iced_graphics::Renderer`
Thanks to @tarkah for pointing this out!
Diffstat (limited to 'graphics')
-rw-r--r--graphics/src/renderer.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/graphics/src/renderer.rs b/graphics/src/renderer.rs
index 125962ba..df9f1ac0 100644
--- a/graphics/src/renderer.rs
+++ b/graphics/src/renderer.rs
@@ -53,8 +53,7 @@ where
}
fn with_layer(&mut self, bounds: Rectangle, f: impl FnOnce(&mut Self)) {
- let current_primitives =
- std::mem::replace(&mut self.primitives, Vec::new());
+ let current_primitives = std::mem::take(&mut self.primitives);
f(self);
@@ -74,8 +73,7 @@ where
translation: Vector,
f: impl FnOnce(&mut Self),
) {
- let current_primitives =
- std::mem::replace(&mut self.primitives, Vec::new());
+ let current_primitives = std::mem::take(&mut self.primitives);
f(self);