Skip to content

Commit 2e59e4e

Browse files
committed
reorder: restore fallback comparison by alias
The tests were modified in fa75ef4 (part of #2535), probably accidentally as the comments documenting the old expectations were kept.
1 parent 9c69cf0 commit 2e59e4e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/imports.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,8 @@ impl Ord for UseTree {
708708
}
709709
}
710710

711-
self.path.len().cmp(&other.path.len())
711+
Ord::cmp(&self.path.len(), &other.path.len())
712+
.then(Ord::cmp(&self.path.last(), &other.path.last()))
712713
}
713714
}
714715

tests/target/imports-reorder-lines.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ use aaa::*;
1515
mod test {}
1616
// If item names are equal, order by rename
1717

18-
use test::{a as bb, b};
1918
use test::{a as aa, c};
19+
use test::{a as bb, b};
2020

2121
mod test {}
2222
// If item names are equal, order by rename - no rename comes before a rename
2323

24-
use test::{a as bb, b};
2524
use test::{a, c};
25+
use test::{a as bb, b};
2626

2727
mod test {}
2828
// `self` always comes first

0 commit comments

Comments
 (0)