Skip to content

Commit 8effa5d

Browse files
committed
reorder: slightly simplify impl Ord for UseTree
No functional change.
1 parent 1943362 commit 8effa5d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/imports.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,12 +689,11 @@ impl Ord for UseSegment {
689689
impl Ord for UseTree {
690690
fn cmp(&self, other: &UseTree) -> Ordering {
691691
for (a, b) in self.path.iter().zip(other.path.iter()) {
692-
let ord = a.cmp(b);
693692
// The comparison without aliases is a hack to avoid situations like
694693
// comparing `a::b` to `a as c` - where the latter should be ordered
695694
// first since it is shorter.
696-
if ord != Ordering::Equal && a.remove_alias().cmp(&b.remove_alias()) != Ordering::Equal
697-
{
695+
let ord = a.remove_alias().cmp(&b.remove_alias());
696+
if ord != Ordering::Equal {
698697
return ord;
699698
}
700699
}

0 commit comments

Comments
 (0)