More readable assert_eq proposal by lpil · Pull Request #1866 · rust-lang/rfcs (original) (raw)
The RFC should also address assert_ne
(as suggested in #1864 (comment)).
How would those LLVM style arrows look like, if both left/right expressions wrap around several lines and the difference is somewhere in the middle? Would that still be readable and look good?
Just as a sidenote: git diff --word-diff
uses a format, which is also readable without colors.
The quick [-red-]{+brown+} fox jumps over the lazy dog
Maybe printing a diff in this style could be a colorless alternative to LLVM style arrows, but it might become less readable or even ambiguous if the underlying text contains a lot of special characters, too.
Alternatively, inspecting/printing the diff of the debug outputs could be left to a third party crate like pretty_assertions. As already pointed out, diffing the debug output is nothing more than a heuristic anyway, since debug output equality can be completely unrelated to the values equality.