From a2587c5ac8f13c757f7932dfdb48a30f78bc8325 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 26 May 2022 11:25:42 +1000 Subject: [PATCH] Match against an optional single trailing colon 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. --- src/util/amount.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/amount.rs b/src/util/amount.rs index eebca34..18f2e72 100644 --- a/src/util/amount.rs +++ b/src/util/amount.rs @@ -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() { @@ -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() {