Skip to content

Commit

Permalink
Merge #1010: Match against an optional single trailing colon
Browse files Browse the repository at this point in the history
88ce8fe Match against an optional single trailing colon (Tobin C. Harding)

Pull request description:

  Currently we allow multiple trailing colons when matching within the
  `check_format_non_negative` macro. We can be more restrictive with no
  loss of usability.

  Use `$(;)?` instead of `$(;)*` to match against 0 or 1 semi-colons
  instead of 0 or more.

  Done as part of the [edition 2018 checklist](#510).

ACKs for top commit:
  Kixunil:
    ACK 88ce8fe
  apoelstra:
    ACK 88ce8fe

Tree-SHA512: 4409c094f6a0aa49ddebdad850fd1d5a31a57dae8828f5a1db0ee5a855e1bce9e43aea69fa0b4d132068c3a43f1f62d35409b9ac5b32ed876e4dd586829e8e68
  • Loading branch information
apoelstra committed May 27, 2022
2 parents 015b7da + 88ce8fe commit 99ae48a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util/amount.rs
Expand Up @@ -1640,7 +1640,7 @@ mod tests {

// Creates individual test functions to make it easier to find which check failed.
macro_rules! check_format_non_negative {
($denom:ident; $($test_name:ident, $val:expr, $format_string:expr, $expected:expr);* $(;)*) => {
($denom:ident; $($test_name:ident, $val:expr, $format_string:expr, $expected:expr);* $(;)?) => {
$(
#[test]
fn $test_name() {
Expand All @@ -1652,7 +1652,7 @@ mod tests {
}

macro_rules! check_format_non_negative_show_denom {
($denom:ident, $denom_suffix:expr; $($test_name:ident, $val:expr, $format_string:expr, $expected:expr);* $(;)*) => {
($denom:ident, $denom_suffix:expr; $($test_name:ident, $val:expr, $format_string:expr, $expected:expr);* $(;)?) => {
$(
#[test]
fn $test_name() {
Expand Down

0 comments on commit 99ae48a

Please sign in to comment.