Skip to content

Commit

Permalink
reorder: restore fallback comparison by alias
Browse files Browse the repository at this point in the history
The tests were modified in fa75ef4 (part of rust-lang#2535), probably
accidentally as the comments documenting the old expectations were kept.
  • Loading branch information
tanriol committed Mar 28, 2020
1 parent e512cd5 commit 4f3b166
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion rustfmt-core/rustfmt-lib/src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,8 @@ impl Ord for UseTree {
}
}

self.path.len().cmp(&other.path.len())
Ord::cmp(&self.path.len(), &other.path.len())
.then(Ord::cmp(&self.path.last(), &other.path.last()))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ use aaa::*;
mod test {}
// If item names are equal, order by rename

use test::{a as bb, b};
use test::{a as aa, c};
use test::{a as bb, b};

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

use test::{a as bb, b};
use test::{a, c};
use test::{a as bb, b};

mod test {}
// `self` always comes first
Expand Down

0 comments on commit 4f3b166

Please sign in to comment.