Merge rust-bitcoin/rust-bitcoin#784: replace unncessary closure with function pointer in FromStr::from_str for Deonomation
8fef869c15
repalce unncessary extra closure with function pointer in starts_with_uppercase closure inside Denomination from_str (KaFai Choi) Pull request description: Follow-up PR from https://github.com/rust-bitcoin/rust-bitcoin/pull/768 https://github.com/rust-bitcoin/rust-bitcoin/pull/768#discussion_r784684641 ACKs for top commit: apoelstra: ACK8fef869c15
dr-orlovsky: ACK8fef869c15
Tree-SHA512: 3fd7d77805e047a692c53ca7677d7857baa00f529e15696790544a47cebe8a143c1c11f95401436d5322b6da24bc61cc9982a069c883b4815b6c50e8bd31553e
This commit is contained in:
commit
17c3547add
|
@ -85,7 +85,7 @@ impl FromStr for Denomination {
|
||||||
use self::ParseAmountError::*;
|
use self::ParseAmountError::*;
|
||||||
use self::Denomination as D;
|
use self::Denomination as D;
|
||||||
|
|
||||||
let starts_with_uppercase = || s.starts_with(|ch: char| ch.is_uppercase());
|
let starts_with_uppercase = || s.starts_with(char::is_uppercase);
|
||||||
match denomination_from_str(s) {
|
match denomination_from_str(s) {
|
||||||
None => Err(UnknownDenomination(s.to_owned())),
|
None => Err(UnknownDenomination(s.to_owned())),
|
||||||
Some(D::MilliBitcoin) | Some(D::PicoBitcoin) | Some(D::MilliSatoshi) if starts_with_uppercase() => {
|
Some(D::MilliBitcoin) | Some(D::PicoBitcoin) | Some(D::MilliSatoshi) if starts_with_uppercase() => {
|
||||||
|
|
Loading…
Reference in New Issue