Skip to content

Commit c7a8f12

Browse files
committed
Use sort_by_key
1 parent 8d767fc commit c7a8f12

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/help.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub fn prune_spans_to_fit_width(
113113
let mut spans_with_priority_with_index: Vec<(usize, &SpansWithPriority)> =
114114
spans_with_priorities.iter().enumerate().collect();
115115

116-
spans_with_priority_with_index.sort_by(|(_, sp1), (_, sp2)| sp2.priority.cmp(&sp1.priority));
116+
spans_with_priority_with_index.sort_by_key(|(_, sp)| std::cmp::Reverse(sp.priority));
117117

118118
let mut prune: Vec<usize> = Vec::new();
119119
for (i, sp) in &spans_with_priority_with_index {

0 commit comments

Comments
 (0)