summaryrefslogtreecommitdiff
path: root/cli/import_map.rs
diff options
context:
space:
mode:
authorAxetroy <axetroy.dev@gmail.com>2019-12-23 22:59:44 +0800
committerRy Dahl <ry@tinyclouds.org>2019-12-23 09:59:44 -0500
commit3bb15ceaeaf5cd349afcb2e2d43374efd420aaef (patch)
treeb169369521f66bbca1c71a96f0059bef6d61fe00 /cli/import_map.rs
parente88c801e76c16d4c0a92702e248cf811038ed4ab (diff)
Upgrades rust to 1.40.0 (#3542)
Diffstat (limited to 'cli/import_map.rs')
-rw-r--r--cli/import_map.rs24
1 files changed, 8 insertions, 16 deletions
diff --git a/cli/import_map.rs b/cli/import_map.rs
index d2916c198..26f1dd86a 100644
--- a/cli/import_map.rs
+++ b/cli/import_map.rs
@@ -255,14 +255,10 @@ impl ImportMap {
}
// Sort in longest and alphabetical order.
- normalized_map.sort_by(|k1, _v1, k2, _v2| {
- if k1.len() > k2.len() {
- return Ordering::Less;
- } else if k2.len() > k1.len() {
- return Ordering::Greater;
- }
-
- k2.cmp(k1)
+ normalized_map.sort_by(|k1, _v1, k2, _v2| match k1.cmp(&k2) {
+ Ordering::Greater => Ordering::Less,
+ Ordering::Less => Ordering::Greater,
+ Ordering::Equal => k2.cmp(k1),
});
normalized_map
@@ -313,14 +309,10 @@ impl ImportMap {
}
// Sort in longest and alphabetical order.
- normalized_map.sort_by(|k1, _v1, k2, _v2| {
- if k1.len() > k2.len() {
- return Ordering::Less;
- } else if k2.len() > k1.len() {
- return Ordering::Greater;
- }
-
- k2.cmp(k1)
+ normalized_map.sort_by(|k1, _v1, k2, _v2| match k1.cmp(&k2) {
+ Ordering::Greater => Ordering::Less,
+ Ordering::Less => Ordering::Greater,
+ Ordering::Equal => k2.cmp(k1),
});
Ok(normalized_map)