Skip to content

Commit 60f2089

Browse files
committed
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.
1 parent aeca93b commit 60f2089

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

units/src/amount/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl Denomination {
126126

127127
/// These form are ambigous and could have many meanings. For example, M could denote Mega or Milli.
128128
/// If any of these forms are used, an error type PossiblyConfusingDenomination is returned.
129-
const CONFUSING_FORMS: [&str; 6] = ["MBTC", "Mbtc", "CBTC", "Cbtc", "UBTC", "Ubtc"];
129+
const CONFUSING_FORMS: [&str; 6] = ["CBTC", "Cbtc", "MBTC", "Mbtc", "UBTC", "Ubtc"];
130130

131131
impl fmt::Display for Denomination {
132132
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(self.as_str()) }
@@ -139,10 +139,9 @@ impl FromStr for Denomination {
139139
///
140140
/// # Errors
141141
///
142-
/// - If the denomination begins with a capital `M` a [`PossiblyConfusingDenominationError`] is
143-
/// returned.
144-
///
145-
/// - If an unknown denomination is used, an [`UnknownDenominationError`] is returned.
142+
/// - [`ParseDenominationError::PossiblyConfusing`]: If the denomination begins with a capital
143+
/// letter that could be confused with centi, milli, or micro-bitcoin.
144+
/// - [`ParseDenominationError::Unknown`]: If an unknown denomination is used.
146145
fn from_str(s: &str) -> Result<Self, Self::Err> {
147146
use self::ParseDenominationError::*;
148147

0 commit comments

Comments
 (0)