Merge rust-bitcoin/rust-bitcoin#3741: Clean up possibly confusing
60f2089dcd
Clean up possibly confusing (Tobin C. Harding)
Pull request description:
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.
ACKs for top commit:
apoelstra:
ACK 60f2089dcdd697b8ab53c9f96b2192ca030237ac; successfully ran local tests
Tree-SHA512: 109fd3e9b72860c3e2a1268aeafab30d6b2b6fac5d5835db6c216a434b9e175911e6445c187f6b80ab2d8c54184df9338230985a4e030aa146cd9fa410971216
This commit is contained in:
commit
7dd004b59f
|
@ -126,7 +126,7 @@ impl Denomination {
|
||||||
|
|
||||||
/// These form are ambigous and could have many meanings. For example, M could denote Mega or Milli.
|
/// 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.
|
/// 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 {
|
impl fmt::Display for Denomination {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(self.as_str()) }
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(self.as_str()) }
|
||||||
|
@ -139,10 +139,9 @@ impl FromStr for Denomination {
|
||||||
///
|
///
|
||||||
/// # Errors
|
/// # Errors
|
||||||
///
|
///
|
||||||
/// - If the denomination begins with a capital `M` a [`PossiblyConfusingDenominationError`] is
|
/// - [`ParseDenominationError::PossiblyConfusing`]: If the denomination begins with a capital
|
||||||
/// returned.
|
/// letter that could be confused with centi, milli, or micro-bitcoin.
|
||||||
///
|
/// - [`ParseDenominationError::Unknown`]: If an unknown denomination is used.
|
||||||
/// - If an unknown denomination is used, an [`UnknownDenominationError`] is returned.
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||||
use self::ParseDenominationError::*;
|
use self::ParseDenominationError::*;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue