Skip to content

Commit

Permalink
Don't consume the expression in assert_matches!()'s failure case.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-ou-se committed Mar 4, 2021
1 parent 5bd1204 commit f223aff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ macro_rules! assert_matches {
($left:expr, $( $pattern:pat )|+ $( if $guard: expr )? $(,)?) => ({
match $left {
$( $pattern )|+ $( if $guard )? => {}
left_val => {
ref left_val => {
$crate::panicking::assert_matches_failed(
&left_val,
left_val,
$crate::stringify!($($pattern)|+ $(if $guard)?),
$crate::option::Option::None
);
Expand All @@ -153,9 +153,9 @@ macro_rules! assert_matches {
($left:expr, $( $pattern:pat )|+ $( if $guard: expr )?, $($arg:tt)+) => ({
match $left {
$( $pattern )|+ $( if $guard )? => {}
left_val => {
ref left_val => {
$crate::panicking::assert_matches_failed(
&left_val,
left_val,
$crate::stringify!($($pattern)|+ $(if $guard)?),
$crate::option::Option::Some($crate::format_args!($($arg)+))
);
Expand Down

0 comments on commit f223aff

Please sign in to comment.