Merge rust-bitcoin/rust-bitcoin#1010: Match against an optional single trailing colon

88ce8fe923 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](https://github.com/rust-bitcoin/rust-bitcoin/issues/510).

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

Tree-SHA512: 4409c094f6a0aa49ddebdad850fd1d5a31a57dae8828f5a1db0ee5a855e1bce9e43aea69fa0b4d132068c3a43f1f62d35409b9ac5b32ed876e4dd586829e8e68
This commit is contained in:
Andrew Poelstra 2022-05-27 15:52:59 +00:00
commit 99ae48ab01
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 2 additions and 2 deletions

View File

@ -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() {