From 7c27f869c9107810f71d900b2a59e51cbfa98e0f Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Sun, 13 Aug 2023 22:14:32 -0700 Subject: [PATCH] cargo fmt --- dyesub-tool/src/main.rs | 6 +++--- dyesub-tool/src/svg/measure.rs | 7 +++++-- dyesub-tool/src/svg/mod.rs | 2 +- dyesub-tool/src/svg/unit.rs | 38 +++++++++++++++++++--------------- 4 files changed, 30 insertions(+), 23 deletions(-) diff --git a/dyesub-tool/src/main.rs b/dyesub-tool/src/main.rs index dd455cd..0a4c50d 100644 --- a/dyesub-tool/src/main.rs +++ b/dyesub-tool/src/main.rs @@ -1,9 +1,9 @@ pub mod svg; use svg::*; -use std::{fs::OpenOptions, io::Write}; use askama::Template; use derive_more::From; +use std::{fs::OpenOptions, io::Write}; #[derive(Template)] #[template(path = "document.xml")] @@ -25,8 +25,8 @@ fn main() -> Result<(), Error> { .create(true) .open("output.svg")?; let document = DocumentTemplate { - width: SVGMeasure::new(8.5, SVGUnit::Inch), - height: SVGMeasure::new(11.0,SVGUnit::Inch), + width: SVGMeasure::new(8.5, SVGUnit::Inch), + height: SVGMeasure::new(11.0, SVGUnit::Inch), }; write!(file, "{}", document.render()?)?; Ok(()) diff --git a/dyesub-tool/src/svg/measure.rs b/dyesub-tool/src/svg/measure.rs index 6750efc..1fb1398 100644 --- a/dyesub-tool/src/svg/measure.rs +++ b/dyesub-tool/src/svg/measure.rs @@ -1,6 +1,9 @@ use super::SVGUnit; use std::fmt; -use std::{ops::{Add, Sub, Mul, Div}, fmt::Display}; +use std::{ + fmt::Display, + ops::{Add, Div, Mul, Sub}, +}; pub struct SVGMeasure { pub measure: f64, @@ -49,4 +52,4 @@ impl Div for SVGMeasure { fn div(self, scalar: f64) -> SVGMeasure { SVGMeasure::new(self.measure / scalar, self.unit) } -} \ No newline at end of file +} diff --git a/dyesub-tool/src/svg/mod.rs b/dyesub-tool/src/svg/mod.rs index 3c500f1..2c4d0fd 100644 --- a/dyesub-tool/src/svg/mod.rs +++ b/dyesub-tool/src/svg/mod.rs @@ -2,4 +2,4 @@ mod unit; pub use unit::SVGUnit; mod measure; -pub use measure::SVGMeasure; \ No newline at end of file +pub use measure::SVGMeasure; diff --git a/dyesub-tool/src/svg/unit.rs b/dyesub-tool/src/svg/unit.rs index 6c4ef9a..da85208 100644 --- a/dyesub-tool/src/svg/unit.rs +++ b/dyesub-tool/src/svg/unit.rs @@ -35,21 +35,25 @@ pub enum SVGUnit { impl Display for SVGUnit { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { use SVGUnit::*; - write!(f, "{}", match &self { - Pixel => "px", - Inch => "in", - Centimeter => "cm", - Millimeter => "mm", - Point => "pt", - Pica => "pc", - Em => "em", - Ex => "ex", - Character => "ch", - Rem => "rem", - ViewportWidth => "vw", - ViewportHeight => "vh", - ViewportMinimum => "vmin", - ViewportMaximum => "vmax", - }) + write!( + f, + "{}", + match &self { + Pixel => "px", + Inch => "in", + Centimeter => "cm", + Millimeter => "mm", + Point => "pt", + Pica => "pc", + Em => "em", + Ex => "ex", + Character => "ch", + Rem => "rem", + ViewportWidth => "vw", + ViewportHeight => "vh", + ViewportMinimum => "vmin", + ViewportMaximum => "vmax", + } + ) } -} \ No newline at end of file +}