From 60f2089dcdd697b8ab53c9f96b2192ca030237ac Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 12 Dec 2024 11:38:32 +1100 Subject: [PATCH] Clean up possibly confusing Put the list of possibly confusing forms in the same order as the enum and fix the rustdocs to show the actual error variants returned. --- units/src/amount/mod.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/units/src/amount/mod.rs b/units/src/amount/mod.rs index db027a191..93783085e 100644 --- a/units/src/amount/mod.rs +++ b/units/src/amount/mod.rs @@ -126,7 +126,7 @@ impl Denomination { /// These form are ambigous and could have many meanings. For example, M could denote Mega or Milli. /// If any of these forms are used, an error type PossiblyConfusingDenomination is returned. -const CONFUSING_FORMS: [&str; 6] = ["MBTC", "Mbtc", "CBTC", "Cbtc", "UBTC", "Ubtc"]; +const CONFUSING_FORMS: [&str; 6] = ["CBTC", "Cbtc", "MBTC", "Mbtc", "UBTC", "Ubtc"]; impl fmt::Display for Denomination { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(self.as_str()) } @@ -139,10 +139,9 @@ impl FromStr for Denomination { /// /// # Errors /// - /// - If the denomination begins with a capital `M` a [`PossiblyConfusingDenominationError`] is - /// returned. - /// - /// - If an unknown denomination is used, an [`UnknownDenominationError`] is returned. + /// - [`ParseDenominationError::PossiblyConfusing`]: If the denomination begins with a capital + /// letter that could be confused with centi, milli, or micro-bitcoin. + /// - [`ParseDenominationError::Unknown`]: If an unknown denomination is used. fn from_str(s: &str) -> Result { use self::ParseDenominationError::*;