Why is Rust's assert_eq! implemented using a match?
问题 Here's Rust's assert_eq! macro implementation. I've copied only the first branch for brevity: macro_rules! assert_eq { ($left:expr, $right:expr) => ({ match (&$left, &$right) { (left_val, right_val) => { if !(*left_val == *right_val) { panic!(r#"assertion failed: `(left == right)` left: `{:?}`, right: `{:?}`"#, left_val, right_val) } } } }); } What's the purpose of the match here? Why isn't checking for non-equality enough? 回答1: Alright, let's remove the match. macro_rules! assert_eq_2 { (