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