assert_eq!(expected, actual) VS assert_eq!(actual, expected) (opens in new tab)
When an assert_eq! fails, you get a very generic "left VS right" message: assertion `left == right` failed left: "a" right: "b" This makes it hard to read output of failing tests if you're unsure whether the "expected" value is the "left" or the "right". I frequently come across Rust codebases that have a different order (actual VS expected OR expected VS actual), even in the same test module! A quick GitHub search shows: assert_eq!(expected, actual) is used 17,600 times assert_eq!(a...
Read the original article