this post was submitted on 07 Jan 2024
14 points (100.0% liked)
Rust
6049 readers
56 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I'm guessing you're asking because you got a clippy lint. Using
Ordering
allows you tomatch
the output therefore only callingpartial_ord
once, 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.