Rollup merge of #108829 - xfix:use-edition-2021-pat-in-matches, r=Mark-Simulacrum
Use Edition 2021 :pat in matches macro This makes the macro syntax used in documentation more readable.
This commit is contained in:
commit
acaae90bf5
1 changed files with 2 additions and 2 deletions
|
@ -340,9 +340,9 @@ pub macro debug_assert_matches($($arg:tt)*) {
|
||||||
#[stable(feature = "matches_macro", since = "1.42.0")]
|
#[stable(feature = "matches_macro", since = "1.42.0")]
|
||||||
#[cfg_attr(not(test), rustc_diagnostic_item = "matches_macro")]
|
#[cfg_attr(not(test), rustc_diagnostic_item = "matches_macro")]
|
||||||
macro_rules! matches {
|
macro_rules! matches {
|
||||||
($expression:expr, $(|)? $( $pattern:pat_param )|+ $( if $guard: expr )? $(,)?) => {
|
($expression:expr, $pattern:pat $(if $guard:expr)? $(,)?) => {
|
||||||
match $expression {
|
match $expression {
|
||||||
$( $pattern )|+ $( if $guard )? => true,
|
$pattern $(if $guard)? => true,
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue