Skip to content

Commit f20f44d

Browse files
committed
reorder: slightly simplify impl Ord for UseTree
No functional change.
1 parent 2bb8b71 commit f20f44d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

rustfmt-core/rustfmt-lib/src/imports.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,12 +707,11 @@ impl Ord for UseSegment {
707707
impl Ord for UseTree {
708708
fn cmp(&self, other: &UseTree) -> Ordering {
709709
for (a, b) in self.path.iter().zip(other.path.iter()) {
710-
let ord = a.cmp(b);
711710
// The comparison without aliases is a hack to avoid situations like
712711
// comparing `a::b` to `a as c` - where the latter should be ordered
713712
// first since it is shorter.
714-
if ord != Ordering::Equal && a.remove_alias().cmp(&b.remove_alias()) != Ordering::Equal
715-
{
713+
let ord = a.remove_alias().cmp(&b.remove_alias());
714+
if ord != Ordering::Equal {
716715
return ord;
717716
}
718717
}

0 commit comments

Comments
 (0)