Skip to content

Commit 1b217f4

Browse files
committed
Add testcase
1 parent 9a6064c commit 1b217f4

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

libs/sheet/src/theme.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,6 @@ impl Theme {
683683
themes: &BTreeMap<String, BTreeMap<String, TokenValues>>,
684684
breakpoints: &[u16],
685685
) {
686-
use std::cmp::Ordering;
687-
688686
if themes.is_empty() {
689687
return;
690688
}
@@ -700,13 +698,9 @@ impl Theme {
700698
let mut sorted_variants: Vec<_> = themes.iter().collect();
701699
let dk = &default_key;
702700
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)
701+
let ad = a.0 == dk;
702+
let bd = b.0 == dk;
703+
if ad || bd { bd.cmp(&ad) } else { a.0.cmp(b.0) }
710704
});
711705

712706
for (variant_name, token_theme) in &sorted_variants {

0 commit comments

Comments
 (0)