diff options
| author | Arne Dußin | 2020-11-10 19:14:53 +0100 |
|---|---|---|
| committer | Arne Dußin | 2020-11-10 19:14:53 +0100 |
| commit | 94b9d39bd32ced4435951dc7a61612c3ea826b87 (patch) | |
| tree | 17a948c8127bfd5a36e9768ffc947b5f08356f4d /src/dimension_indicator.rs | |
| parent | 2315064b28627b1490016f3b45e8dee187ed9e05 (diff) | |
| download | graf_karto-94b9d39bd32ced4435951dc7a61612c3ea826b87.tar.gz graf_karto-94b9d39bd32ced4435951dc7a61612c3ea826b87.zip | |
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.
Diffstat (limited to 'src/dimension_indicator.rs')
| -rw-r--r-- | src/dimension_indicator.rs | 7 |
1 files changed, 4 insertions, 3 deletions
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<Vec2<f32>>) -> Self { + pub fn from_corner_points(corner_points: &[Vec2<f32>]) -> 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, |
