Skip to content

Commit

Permalink
Inline semver::Version in toolchain_sort
Browse files Browse the repository at this point in the history
  • Loading branch information
rami3l committed Nov 6, 2023
1 parent 435ed0d commit 01bc242
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/toolchain/names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,6 @@ impl Display for ToolchainName {
/// 2. `X.Y.Z-suffix` names, sorted by semver rules on `X.Y.Z`, then by `suffix`.
/// 3. Other names, sorted alphanumerically.
pub(crate) fn toolchain_sort(v: &mut [ToolchainName]) {
use semver::Version;

v.sort_by_key(|name| {
let s = name.to_string();
if s.starts_with("stable") {
Expand All @@ -327,7 +325,7 @@ pub(crate) fn toolchain_sort(v: &mut [ToolchainName]) {
return (2, None, s);
}
if let Some((ver_str, suffix)) = s.split_once('-') {
if let Ok(ver) = Version::parse(ver_str) {
if let Ok(ver) = semver::Version::parse(ver_str) {
return (3, Some(ver), suffix.to_owned());
}
}
Expand Down

0 comments on commit 01bc242

Please sign in to comment.