mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 22:53:28 +00:00
Don't consume the expression in assert_matches!()'s failure case.
This commit is contained in:
parent
5bd1204fc2
commit
f223affd7a
@ -141,9 +141,9 @@ macro_rules! assert_matches {
|
|||||||
($left:expr, $( $pattern:pat )|+ $( if $guard: expr )? $(,)?) => ({
|
($left:expr, $( $pattern:pat )|+ $( if $guard: expr )? $(,)?) => ({
|
||||||
match $left {
|
match $left {
|
||||||
$( $pattern )|+ $( if $guard )? => {}
|
$( $pattern )|+ $( if $guard )? => {}
|
||||||
left_val => {
|
ref left_val => {
|
||||||
$crate::panicking::assert_matches_failed(
|
$crate::panicking::assert_matches_failed(
|
||||||
&left_val,
|
left_val,
|
||||||
$crate::stringify!($($pattern)|+ $(if $guard)?),
|
$crate::stringify!($($pattern)|+ $(if $guard)?),
|
||||||
$crate::option::Option::None
|
$crate::option::Option::None
|
||||||
);
|
);
|
||||||
@ -153,9 +153,9 @@ macro_rules! assert_matches {
|
|||||||
($left:expr, $( $pattern:pat )|+ $( if $guard: expr )?, $($arg:tt)+) => ({
|
($left:expr, $( $pattern:pat )|+ $( if $guard: expr )?, $($arg:tt)+) => ({
|
||||||
match $left {
|
match $left {
|
||||||
$( $pattern )|+ $( if $guard )? => {}
|
$( $pattern )|+ $( if $guard )? => {}
|
||||||
left_val => {
|
ref left_val => {
|
||||||
$crate::panicking::assert_matches_failed(
|
$crate::panicking::assert_matches_failed(
|
||||||
&left_val,
|
left_val,
|
||||||
$crate::stringify!($($pattern)|+ $(if $guard)?),
|
$crate::stringify!($($pattern)|+ $(if $guard)?),
|
||||||
$crate::option::Option::Some($crate::format_args!($($arg)+))
|
$crate::option::Option::Some($crate::format_args!($($arg)+))
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user