DEV Community

Discussion on: How to sort a vector of a custom struct in Rust

Collapse
 
lexlohr profile image
Alex Lohr

Why is that? Also, if you are concerned it could be misunderstood, put the lambda in a separate named function called reverse_order or something.

Collapse
 
thiagomg profile image
Thiago Massari Guedes

Now this is on the preference realm. After living many, many years in the low latency world, where things are not super readable, I like explicit things when possible, such as the block:

Ordering::Less => Ordering::Greater,
Ordering::Greater => Ordering::Less,
Enter fullscreen mode Exit fullscreen mode

And, of course, that's my personal preference :) Both are ok - and I agree with you that the function name is better using a descriptive name.

Thread Thread
 
thiagomg profile image
Thiago Massari Guedes

And thanks for the feedback!