Exclude formatting of function fmt_satoshi_in

This function is called in a long but clear manner, skip it when
formatting.
This commit is contained in:
Tobin C. Harding 2022-11-16 10:10:54 +11:00
parent 308a12b7cf
commit ff5a80dbd3
1 changed files with 6 additions and 2 deletions

View File

@ -600,6 +600,7 @@ impl Amount {
/// Format the value of this [Amount] in the given denomination. /// Format the value of this [Amount] in the given denomination.
/// ///
/// Does not include the denomination. /// Does not include the denomination.
#[rustfmt::skip]
pub fn fmt_value_in(self, f: &mut dyn fmt::Write, denom: Denomination) -> fmt::Result { pub fn fmt_value_in(self, f: &mut dyn fmt::Write, denom: Denomination) -> fmt::Result {
fmt_satoshi_in(self.to_sat(), false, f, denom, false, FormatOptions::default()) fmt_satoshi_in(self.to_sat(), false, f, denom, false, FormatOptions::default())
} }
@ -808,10 +809,13 @@ impl Display {
} }
impl fmt::Display for Display { impl fmt::Display for Display {
#[rustfmt::skip]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let format_options = FormatOptions::from_formatter(f); let format_options = FormatOptions::from_formatter(f);
match &self.style { match &self.style {
DisplayStyle::FixedDenomination { show_denomination, denomination } => fmt_satoshi_in(self.sats_abs, self.is_negative, f, *denomination, *show_denomination, format_options), DisplayStyle::FixedDenomination { show_denomination, denomination } => {
fmt_satoshi_in(self.sats_abs, self.is_negative, f, *denomination, *show_denomination, format_options)
},
DisplayStyle::DynamicDenomination if self.sats_abs >= Amount::ONE_BTC.to_sat() => { DisplayStyle::DynamicDenomination if self.sats_abs >= Amount::ONE_BTC.to_sat() => {
fmt_satoshi_in(self.sats_abs, self.is_negative, f, Denomination::Bitcoin, true, format_options) fmt_satoshi_in(self.sats_abs, self.is_negative, f, Denomination::Bitcoin, true, format_options)
}, },
@ -971,8 +975,8 @@ impl SignedAmount {
/// Format the value of this [SignedAmount] in the given denomination. /// Format the value of this [SignedAmount] in the given denomination.
/// ///
/// Does not include the denomination. /// Does not include the denomination.
#[rustfmt::skip]
pub fn fmt_value_in(self, f: &mut dyn fmt::Write, denom: Denomination) -> fmt::Result { pub fn fmt_value_in(self, f: &mut dyn fmt::Write, denom: Denomination) -> fmt::Result {
fmt_satoshi_in(self.to_sat_abs(), self.is_negative(), f, denom, false, FormatOptions::default()) fmt_satoshi_in(self.to_sat_abs(), self.is_negative(), f, denom, false, FormatOptions::default())
} }