Open
Description
It's pretty annoying for a new Rust programmer to have a pretty unhelpful error message when using the default assert!
macro in tests or suchlike. They have to know that the "correct" way to do it is to use assert_eq!
or assert_ne!
, which do print the value of their arguments. I suggest that we extend the default assert!
macro to print operands in simple cases, and then fall back to the current behaviour if an explicit message is provided or if the expression is complex.
I actually thought that Python did this already and I was going to use it as precedent, but its default assertion message is even worse than Rust's.
I have a simple implementation of this here, with the message modelled on assert_eq
/assert_ne
's message.