mirror of
https://gitee.com/openharmony/third_party_rust_version_check
synced 2024-11-23 07:49:54 +00:00
Parse raw channel strings as well.
This commit is contained in:
parent
2f9b700d82
commit
e7f0ff4d91
@ -54,11 +54,12 @@ impl Channel {
|
||||
/// assert!(stable.is_stable());
|
||||
/// ```
|
||||
pub fn parse(version: &str) -> Option<Channel> {
|
||||
if version.contains("-dev") {
|
||||
let version = version.trim();
|
||||
if version.contains("-dev") || version == "dev" {
|
||||
Some(Channel(Kind::Dev))
|
||||
} else if version.contains("-nightly") {
|
||||
} else if version.contains("-nightly") || version == "nightly" {
|
||||
Some(Channel(Kind::Nightly))
|
||||
} else if version.contains("-beta") {
|
||||
} else if version.contains("-beta") || version == "beta" {
|
||||
Some(Channel(Kind::Beta))
|
||||
} else if !version.contains("-") {
|
||||
Some(Channel(Kind::Stable))
|
||||
|
Loading…
Reference in New Issue
Block a user