Skip to content

Commit a2587c5

Browse files
committed
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.
1 parent 1090495 commit a2587c5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/util/amount.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@ mod tests {
16401640

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

16541654
macro_rules! check_format_non_negative_show_denom {
1655-
($denom:ident, $denom_suffix:expr; $($test_name:ident, $val:expr, $format_string:expr, $expected:expr);* $(;)*) => {
1655+
($denom:ident, $denom_suffix:expr; $($test_name:ident, $val:expr, $format_string:expr, $expected:expr);* $(;)?) => {
16561656
$(
16571657
#[test]
16581658
fn $test_name() {

0 commit comments

Comments
 (0)