mirror of
https://github.com/lov3b/ecb-rates.git
synced 2025-02-23 02:10:07 +01:00
Use match over elif
This commit is contained in:
parent
0d3ca81319
commit
dde5468e2b
14
src/os.rs
14
src/os.rs
@ -11,15 +11,11 @@ pub enum Os {
|
|||||||
|
|
||||||
impl Os {
|
impl Os {
|
||||||
pub fn get_current() -> Option<Self> {
|
pub fn get_current() -> Option<Self> {
|
||||||
let os_str = env::consts::OS;
|
match env::consts::OS {
|
||||||
if os_str == "windows" {
|
"windows" => Some(Self::Windows),
|
||||||
Some(Os::Windows)
|
"macos" => Some(Self::Mac),
|
||||||
} else if os_str == "macos" {
|
os_str if os_str == "linux" || os_str.contains("bsd") => Some(Self::Unix),
|
||||||
Some(Os::Mac)
|
_ => None,
|
||||||
} else if os_str == "linux" || os_str.contains("bsd") {
|
|
||||||
Some(Os::Unix)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user