External Publication
Visit Post

Change error message of a failing `assert_eq!`

Rust Internals [Unofficial] April 4, 2026
Source

Rather than fiddling around with expected vs actual and updating the macro syntax, I'd rather the message just state what the arguments in the macro were. I.e., assert_eq!(some_object.array[i], Some("foo")) could print something like 'assert some_object.array[i] == Some("foo") failed: left is XXX, right is YYY'

Discussion in the ATmosphere

Loading comments...