Skip to content

Commit

Permalink
Inline channel pattern list
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Nov 6, 2023
1 parent 78d1ad0 commit 733d066
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/dist/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ pub static DEFAULT_DIST_SERVER: &str = "https://static.rust-lang.org";
// Deprecated
pub(crate) static DEFAULT_DIST_ROOT: &str = "https://static.rust-lang.org/dist";

// The channel patterns we support
static TOOLCHAIN_CHANNELS: &[&str] = &[
"nightly",
"beta",
"stable",
// Allow from 1.0.0 through to 9.999.99 with optional patch version
r"\d{1}\.\d{1,3}(?:\.\d{1,2})?",
];

const TOOLSTATE_MSG: &str =
"If you require these components, please install and use the latest successful build version,\n\
which you can find at <https://rust-lang.github.io/rustup-components-history>.\n\nAfter determining \
Expand Down Expand Up @@ -187,7 +178,14 @@ impl FromStr for ParsedToolchainDesc {
static TOOLCHAIN_CHANNEL_RE: Lazy<Regex> = Lazy::new(|| {
Regex::new(&format!(
r"^({})(?:-(\d{{4}}-\d{{2}}-\d{{2}}))?(?:-(.+))?$",
TOOLCHAIN_CHANNELS.join("|")
[ // The channel patterns we support
"nightly",
"beta",
"stable",
// Allow from 1.0.0 through to 9.999.99 with optional patch version
r"\d{1}\.\d{1,3}(?:\.\d{1,2})?",
]
.join("|")
))
.unwrap()
});
Expand Down

0 comments on commit 733d066

Please sign in to comment.