mirror of
				https://github.com/NotAShelf/microfetch.git
				synced 2025-11-03 23:32:19 +00:00 
			
		
		
		
	refactor: directly use key in match statement
This commit is contained in:
		
					parent
					
						
							
								83e02d6fb5
							
						
					
				
			
			
				commit
				
					
						0cf48a4690
					
				
			
		
					 1 changed files with 1 additions and 3 deletions
				
			
		| 
						 | 
					@ -56,9 +56,7 @@ pub fn get_memory_usage() -> Result<String, io::Error> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for line in meminfo.lines() {
 | 
					        for line in meminfo.lines() {
 | 
				
			||||||
            let mut split = line.split_whitespace();
 | 
					            let mut split = line.split_whitespace();
 | 
				
			||||||
            let key = split.next().unwrap_or("");
 | 
					            match split.next().unwrap_or_default() {
 | 
				
			||||||
 | 
					 | 
				
			||||||
            match key {
 | 
					 | 
				
			||||||
                "MemTotal:" => total_memory_kb = split.next().unwrap_or("0").parse().unwrap_or(0.0),
 | 
					                "MemTotal:" => total_memory_kb = split.next().unwrap_or("0").parse().unwrap_or(0.0),
 | 
				
			||||||
                "MemAvailable:" => {
 | 
					                "MemAvailable:" => {
 | 
				
			||||||
                    available_memory_kb = split.next().unwrap_or("0").parse().unwrap_or(0.0);
 | 
					                    available_memory_kb = split.next().unwrap_or("0").parse().unwrap_or(0.0);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue