The “receiver” of a method is the value which takes
self. If swapping the position of the arguments doesn’t change the function’s semantics, I don’t think it should be a method.
The operators make the lhs the receiver because they have to in order to fit in with the way Rust’s trait system works.
However, your comment about using them on user defined
Ord types doesn’t matter so much; these functions could have been defined as methods on
Ord with default implementations (this would also have made them in scope by default, incidentally). I don’t think this matters so much.
FWIW what really seems odd to me is that the cmp traits are in the prelude. You almost never need them. You can use their operator forms without the traits being in scope, and most of the time people implement them by derive, rather than manually. I’m much more likely to use
max than use these traits!
PartialOrd aren’t even usable without importing
Ordering. It seems almost like a mistake that they are included at all.
I’m also much more likely to need to import
Debug than these traits, in my experience, but that’s a bit out of scope.