[pdm-devel] [PATCH proxmox-datacenter-manager v3 4/4] ui: add firewall status tree
Lukas Wagner
l.wagner at proxmox.com
Wed Nov 12 15:41:47 CET 2025
On Wed Nov 12, 2025 at 12:21 PM CET, Stefan Hanreich wrote:
>> +
>> +fn sort_entries(a: &TreeEntry, b: &TreeEntry) -> Ordering {
>> + let rank_a = a.sort_rank();
>> + let rank_b = b.sort_rank();
>> + match rank_a.cmp(&rank_b) {
>> + Ordering::Equal => a.name().cmp(&b.name()),
>> + other => other,
>> + }
>> +}
>
> maybe (a.sort_rank(), a.name()).cmp(&(b.sort_rank(), b.name())), makes
> the intention clearer imo - or is a.name() expensive?
>
I would contest the claim that it's clearer, I actually had to look up
how .cmp works for tuples just now, TIL! :D
But it's more elegant and shorter, that's for sure.
More information about the pdm-devel
mailing list