Skip to content

Commit

Permalink
drop tick and backtick from amount group separator list (RGB-WG#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicbus authored Jun 17, 2024
1 parent 27e7c7f commit 41c881c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions invoice/src/amount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ impl CoinAmount {

impl Display for CoinAmount {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
if ![' ', '\'', '`', '_'].contains(&f.fill()) {
if ![' ', '_'].contains(&f.fill()) {
panic!("disallowed fill character {} in coin amount formatting string", f.fill())
}
if f.precision().is_some() {
Expand Down Expand Up @@ -429,7 +429,7 @@ impl FromStr for CoinAmount {
type Err = AmountParseError;

fn from_str(s: &str) -> Result<Self, Self::Err> {
let s = s.replace([' ', '_', '`', '\''], "");
let s = s.replace([' ', '_'], "");
let (int, remain) = s.split_once('.').unwrap_or_else(|| (&s, "0"));
let (fract, precision) = remain.split_once('~').unwrap_or((remain, ""));
let precision = if precision.is_empty() {
Expand Down Expand Up @@ -461,7 +461,7 @@ mod test {
assert_eq!(amount.int, 10_000);
assert_eq!(amount.fract, 436_081_95);
assert_eq!(format!("{amount}"), "10000.43608195~8");
assert_eq!(format!("{amount:`>#}"), "10`000.43`608`195");
assert_eq!(format!("{amount: >#}"), "10 000.43 608 195");
}

#[test]
Expand Down

0 comments on commit 41c881c

Please sign in to comment.