diff --git a/src/controllers/krate/search.rs b/src/controllers/krate/search.rs index f9c9be8b9d3..d605c0fdc55 100644 --- a/src/controllers/krate/search.rs +++ b/src/controllers/krate/search.rs @@ -181,7 +181,7 @@ pub fn search(req: &mut Request) -> CargoResult { .map(|versions| { versions .into_iter() - .max_by(Version::semantically_newest_first) + .max_by(Version::semver_cmp) .unwrap() }) .collect::>(); diff --git a/src/version/mod.rs b/src/version/mod.rs index 386ede728f5..71dfd5c026b 100644 --- a/src/version/mod.rs +++ b/src/version/mod.rs @@ -175,8 +175,8 @@ impl Version { } /// Orders SemVer numbers so that "higher" version numbers appear first. - pub fn semantically_newest_first(a: &Self, b: &Self) -> ::std::cmp::Ordering { - b.num.cmp(&a.num) + pub fn semver_cmp(a: &Self, b: &Self) -> ::std::cmp::Ordering { + a.num.cmp(&b.num) } }