macro_rules! assert_matches { ($expression:expr, $pattern:pat $( if $guard:expr )?) => { match $expression { $pattern $( if $guard )? => {} left => panic!( "assertion failed: (left ~= right)\n left: `{:?}`\n right: `{}`", left, stringify!($pattern $(if $guard)?) ), } } }