assert_eq!(foo, bar) is great because the assertion formats
bar to show you their values if the assertion is triggered. However,
assert!(foo < bar) completely sucks because of the lack of formatting.
assert_ne! was added, but for reasons I find completely baffling,
assert_ge! (RFC 1662) were rejected. I disagree with some of the arguments in that RFC that it's "trivial to define your own macros if you really want inequality ones" (these macros are not trivial, especially to non-Rust experts).
This has led to people implementing these macros themselves:
And these are only the crates I could find with a quick Google search that publicly export
assert_lt! et al. macros. I'm sure there are crates that implement these macros but don't publicly export them (like my own crate I'm writing).
Can we revisit this RFC? Would people find value in adding
assert_ge! (and their
debug_* counterparts)? I know I would certainly find these valuable and would use them, but I'd like to see if the winds have changed here.
An alternative to these macros would be to change
assert! to parse the expression and format the message accordingly, like assert2. But that would require specialization (or magic) in order to work with left/right-hand arguments that don't implement
Debug, and specialization is a long-way off from what I understand.