Skip to content

Commit

Permalink
use max priority suffix when case doesn't matter
Browse files Browse the repository at this point in the history
  • Loading branch information
matrixhead committed Jul 3, 2024
1 parent 6c458e7 commit 6f8a7a3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -480,12 +480,11 @@ impl LsColors {
}
}
} else {
// case doesn't matter, that means every variant has
// the same style so we could just take the first one.
// case doesn't matter, but we need select the one with the biggest priority.
let (style, priority) = suffix_mapping_entry
.variants
.values()
.next()
.max_by(|x, y| x.1.cmp(&y.1))
// it okay to unwrap here, because there should exist atleast one variant.
.unwrap();
if *priority >= last_matched_priority {
Expand Down

0 comments on commit 6f8a7a3

Please sign in to comment.