14
cmp::Ordering vs comparison symbols
(programming.dev)
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Credits
I'm guessing you're asking because you got a clippy lint. Using
Orderingallows you tomatchthe output therefore only callingpartial_ordonce, compared to using an if-else chain which might call it several times. In many/most cases this would probably be compiler optimized anyway but this makes it explicit.