From 1072ff46601245ecac737b410800689f4a444d46 Mon Sep 17 00:00:00 2001 From: Marc Planard Date: Mon, 5 Jun 2023 13:19:35 +0200 Subject: [PATCH] make clippy happy --- src/transformer.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/transformer.rs b/src/transformer.rs index 6d0c2c2..3728f94 100644 --- a/src/transformer.rs +++ b/src/transformer.rs @@ -1,7 +1,7 @@ use crate::point::Point; pub trait Transformers { - fn apply(&self, point_list: &Vec) -> Vec; + fn apply(&self, point_list: &[Point]) -> Vec; } /// Translate @@ -19,7 +19,7 @@ impl Translate { } impl Transformers for Translate { - fn apply(&self, point_list: &Vec) -> Vec { + fn apply(&self, point_list: &[Point]) -> Vec { point_list.iter() .map(| pt | { Point { x: pt.x + self.x, @@ -32,6 +32,7 @@ impl Transformers for Translate { /// Replicate +#[allow(dead_code)] #[derive(Debug,Clone,Copy)] pub enum Replicate { Until(usize), @@ -39,17 +40,17 @@ pub enum Replicate { } impl Transformers for Replicate { - fn apply(&self, point_list: &Vec) -> Vec { + fn apply(&self, point_list: &[Point]) -> Vec { let mut point_list2 = vec![]; match self { Replicate::Until(n) => { while point_list2.len() < *n { - point_list2.append(&mut point_list.clone()); + point_list2.append(&mut point_list.to_vec()); } }, Replicate::Times(n) => { for _ in 0..*n { - point_list2.append(&mut point_list.clone()); + point_list2.append(&mut point_list.to_vec()); } } }