From 94b9d39bd32ced4435951dc7a61612c3ea826b87 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Tue, 10 Nov 2020 19:14:53 +0100 Subject: Fix some style errors Fixed the last warnings and ran clippy on the project. Fixed where appropriate and taught clippy otherwise. Now runs through clean. --- src/dimension_indicator.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/dimension_indicator.rs') diff --git a/src/dimension_indicator.rs b/src/dimension_indicator.rs index a08d22c..0ea96d3 100644 --- a/src/dimension_indicator.rs +++ b/src/dimension_indicator.rs @@ -10,13 +10,14 @@ pub struct DimensionIndicator { } impl DimensionIndicator { + #[allow(clippy::new_without_default)] pub fn new() -> Self { Self { length_lines: Vec::new(), } } - pub fn from_corner_points(corner_points: &Vec>) -> Self { + pub fn from_corner_points(corner_points: &[Vec2]) -> Self { let mut this = Self::new(); this.update_dimensions(corner_points); @@ -76,7 +77,7 @@ impl DimensionIndicator { // Start with the direction of the line vector. let dir = *start - *end; // Calculate perpendicular vec and normalise. - dir.rotated_90_clockwise() / dir.len() + dir.rotated_90_clockwise() / dir.length() }; // To not have the line directly in the rect, move start and end outside a bit. @@ -112,7 +113,7 @@ impl DimensionIndicator { */ let text_pos = transform.point_m_to_px((*end + *start) / 2.) + line_normal * 20.; rld.draw_text( - &format!("{}m", &(*end - *start).len()), + &format!("{}m", &(*end - *start).length()), text_pos.x as i32, text_pos.y as i32, 20, -- cgit v1.2.3-70-g09d2