Skip to content

Commit

Permalink
Use Edition 2021 :pat in matches macro
Browse files Browse the repository at this point in the history
This makes the macro syntax used in documentation more readable.
  • Loading branch information
KamilaBorowska committed Mar 6, 2023
1 parent f63ccaf commit dfe4c49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,9 @@ pub macro debug_assert_matches($($arg:tt)*) {
#[stable(feature = "matches_macro", since = "1.42.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "matches_macro")]
macro_rules! matches {
($expression:expr, $(|)? $( $pattern:pat_param )|+ $( if $guard: expr )? $(,)?) => {
($expression:expr, $pattern:pat $(if $guard:expr)? $(,)?) => {
match $expression {
$( $pattern )|+ $( if $guard )? => true,
$pattern $(if $guard)? => true,
_ => false
}
};
Expand Down

0 comments on commit dfe4c49

Please sign in to comment.