mirror of
https://github.com/NotAShelf/microfetch.git
synced 2025-11-02 23:16:37 +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() {
|
||||
let mut split = line.split_whitespace();
|
||||
let key = split.next().unwrap_or("");
|
||||
|
||||
match key {
|
||||
match split.next().unwrap_or_default() {
|
||||
"MemTotal:" => total_memory_kb = split.next().unwrap_or("0").parse().unwrap_or(0.0),
|
||||
"MemAvailable:" => {
|
||||
available_memory_kb = split.next().unwrap_or("0").parse().unwrap_or(0.0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue