Change error message of a failing `assert_eq!`
Rust Internals [Unofficial]
March 31, 2026
You may be interested in the assert2 crate:
For the standard library, this could be solved by a debug hook like std::fmt::set_debug_hook, so we can have a separate crate colored_debug_hook that you install, and it intercepts output of any Debug call. We might do something more advanced, and the hook could be able to modify more granular parts of the debug output, like the debug_struct or debug_tuple methods etc.
Discussion in the ATmosphere