Skip to content

Commit baadd1d

Browse files
committed
Swap order of semver comparison when returning search results
This should fix a regression introduced in this commit series.
1 parent 881ff2c commit baadd1d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/controllers/krate/search.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ pub fn search(req: &mut Request) -> CargoResult<Response> {
181181
.map(|versions| {
182182
versions
183183
.into_iter()
184-
.max_by(Version::semantically_newest_first)
184+
.max_by(Version::semver_cmp)
185185
.unwrap()
186186
})
187187
.collect::<Vec<_>>();

src/version/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ impl Version {
175175
}
176176

177177
/// Orders SemVer numbers so that "higher" version numbers appear first.
178-
pub fn semantically_newest_first(a: &Self, b: &Self) -> ::std::cmp::Ordering {
179-
b.num.cmp(&a.num)
178+
pub fn semver_cmp(a: &Self, b: &Self) -> ::std::cmp::Ordering {
179+
a.num.cmp(&b.num)
180180
}
181181
}
182182

0 commit comments

Comments
 (0)