From 6c5d954576fc6f8c1a27d69a7eb31488b7bc2e5d Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 23 Mar 2022 05:30:53 +0000 Subject: refactor(ppm): clone_from_slice instead of clone --- src/ppm.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ppm.rs b/src/ppm.rs index 07d69b8..d39d7ed 100644 --- a/src/ppm.rs +++ b/src/ppm.rs @@ -317,7 +317,9 @@ impl PPMParser { self.stream.read_uint::(1).unwrap() >> 7 & 0x1 != 0 } - fn read_line_types(line_types: &Vec) -> impl Generator + '_ { + fn read_line_types( + #[allow(clippy::ptr_arg)] line_types: &Vec, + ) -> impl Generator + '_ { move || { for index in 0..192 { let line_type = line_types.get(index / 4).unwrap() >> ((index % 4) * 2) & 0x03; @@ -333,7 +335,7 @@ impl PPMParser { } // Copy the current layer buffers to the previous ones - self.prev_layers = self.layers.clone(); + self.prev_layers.clone_from_slice(&self.layers); self.prev_frame_index = index; // Clear the current layer buffers by resetting them to zero self.layers.fill(vec![vec![0u8; 256]; 192]); -- cgit v1.2.3