Skip to content

Commit 9a6064c

Browse files
committed
Add testcase
1 parent 8f4d82b commit 9a6064c

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

libs/sheet/src/theme.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -698,10 +698,15 @@ impl Theme {
698698

699699
// Sort variants: default first, then alphabetical
700700
let mut sorted_variants: Vec<_> = themes.iter().collect();
701-
sorted_variants.sort_by(|a, b| match (a.0 == &default_key, b.0 == &default_key) {
702-
(true, false) => Ordering::Less,
703-
(false, true) => Ordering::Greater,
704-
_ => a.0.cmp(b.0),
701+
let dk = &default_key;
702+
sorted_variants.sort_by(|a, b| {
703+
if a.0 == dk {
704+
return Ordering::Less;
705+
}
706+
if b.0 == dk {
707+
return Ordering::Greater;
708+
}
709+
a.0.cmp(b.0)
705710
});
706711

707712
for (variant_name, token_theme) in &sorted_variants {

0 commit comments

Comments
 (0)