From 37da862c9f59a909a17cb4ca435c8d7f575b83d3 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Mon, 14 Aug 2023 13:58:10 -0700 Subject: [PATCH] cargo fmt --- dyesub-tool/src/main.rs | 17 ++++++++++++----- dyesub-tool/src/svg/measure.rs | 8 ++++---- dyesub-tool/src/svg/tests.rs | 2 +- dyesub-tool/src/svg/unit.rs | 5 ++--- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/dyesub-tool/src/main.rs b/dyesub-tool/src/main.rs index adc69d7..ad15235 100644 --- a/dyesub-tool/src/main.rs +++ b/dyesub-tool/src/main.rs @@ -24,14 +24,21 @@ enum Error { Template(askama::Error), } -fn positions(size: SVGMeasure, padding: SVGMeasure, dimensions: &DocumentDimensions, count: u32) -> Vec<(SVGMeasure, SVGMeasure)> { +fn positions( + size: SVGMeasure, + padding: SVGMeasure, + dimensions: &DocumentDimensions, + count: u32, +) -> Vec<(SVGMeasure, SVGMeasure)> { let grid = size + padding; let row_count = ((dimensions.width - padding * 2.0) / grid) as u32; (0..count) - .map(|i| ( - grid * (i % row_count).into() + padding, - grid * (i / row_count).into() + padding, - )) + .map(|i| { + ( + grid * (i % row_count).into() + padding, + grid * (i / row_count).into() + padding, + ) + }) .collect() } diff --git a/dyesub-tool/src/svg/measure.rs b/dyesub-tool/src/svg/measure.rs index f9814e6..763e147 100644 --- a/dyesub-tool/src/svg/measure.rs +++ b/dyesub-tool/src/svg/measure.rs @@ -1,15 +1,15 @@ use super::SVGUnit; +use derive_more::From; +use lazy_static::lazy_static; +use regex::Regex; use std::cmp::Ordering; use std::fmt; use std::num::ParseFloatError; use std::str::FromStr; use std::{ fmt::Display, - ops::{Add, Div, Mul, Sub, Rem}, + ops::{Add, Div, Mul, Rem, Sub}, }; -use lazy_static::lazy_static; -use regex::Regex; -use derive_more::From; use strum::ParseError; #[derive(Debug, Clone, Copy)] diff --git a/dyesub-tool/src/svg/tests.rs b/dyesub-tool/src/svg/tests.rs index 1c666b9..c8690b9 100644 --- a/dyesub-tool/src/svg/tests.rs +++ b/dyesub-tool/src/svg/tests.rs @@ -63,4 +63,4 @@ fn from_str() { assert_eq!(m_10cm, SVGMeasure::from_str("10cm").unwrap()); assert_eq!(m_5mm, SVGMeasure::from_str("5mm").unwrap()); assert_eq!(m_0, SVGMeasure::from_str("0").unwrap()); -} \ No newline at end of file +} diff --git a/dyesub-tool/src/svg/unit.rs b/dyesub-tool/src/svg/unit.rs index ddfe527..c653555 100644 --- a/dyesub-tool/src/svg/unit.rs +++ b/dyesub-tool/src/svg/unit.rs @@ -1,8 +1,7 @@ use strum_macros::{Display, EnumString, IntoStaticStr}; /// https://oreillymedia.github.io/Using_SVG/guide/units.html -#[derive(Clone, Copy, PartialEq, Eq, Debug)] -#[derive(Display, EnumString, IntoStaticStr)] +#[derive(Clone, Copy, PartialEq, Eq, Debug, Display, EnumString, IntoStaticStr)] pub enum SVGUnit { /// Pixel units, directly equivalent to SVG user units. #[strum(serialize = "px")] @@ -36,4 +35,4 @@ impl SVGUnit { Pica => 16.0, } } -} \ No newline at end of file +}