From 034ffed997ef740d7ae14ef88a3b2d1c8363d9e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Sun, 14 May 2023 02:18:27 +0300 Subject: [PATCH] Order units in order of size --- src/conversions.rs | 8 ++++---- src/units.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/conversions.rs b/src/conversions.rs index 4cc5e1f..0e89b4b 100644 --- a/src/conversions.rs +++ b/src/conversions.rs @@ -21,14 +21,14 @@ fn get_conversion(unit: NonMetric) -> Conversion { match unit { // Length - NonMetric::Foot => Conversion { - from: inch_from, - to: MetricQuantity { amount: 12.0 * inch_to, unit: Metric::Metre }, - }, NonMetric::Inch => Conversion { from: inch_from, to: MetricQuantity { amount: inch_to, unit: Metric::Metre }, }, + NonMetric::Foot => Conversion { + from: inch_from, + to: MetricQuantity { amount: 12.0 * inch_to, unit: Metric::Metre }, + }, NonMetric::Yard => Conversion { from: inch_from, to: MetricQuantity { amount: 3.0 * 12.0 * inch_to, unit: Metric::Metre }, diff --git a/src/units.rs b/src/units.rs index dca8437..6e13eff 100644 --- a/src/units.rs +++ b/src/units.rs @@ -7,10 +7,10 @@ pub enum Metric { #[derive(Clone, Copy, Debug, PartialEq)] pub enum NonMetric { // Length - Foot, Inch, - Mile, + Foot, Yard, + Mile, // Weight Ounce, Pound,