Rollup merge of #74880 - chrisduerr:fix_matches, r=dtolnay

Add trailing comma support to matches macro
This commit is contained in:
Tyler Mandry 2020-09-01 18:24:23 -07:00 committed by GitHub
commit 383da5e1e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -242,7 +242,7 @@ macro_rules! debug_assert_ne {
#[macro_export]
#[stable(feature = "matches_macro", since = "1.42.0")]
macro_rules! matches {
($expression:expr, $( $pattern:pat )|+ $( if $guard: expr )?) => {
($expression:expr, $( $pattern:pat )|+ $( if $guard: expr )? $(,)?) => {
match $expression {
$( $pattern )|+ $( if $guard )? => true,
_ => false