Refactor trim() of input line fetching netdev info
This commit is contained in:
parent
edf84af576
commit
3c0e5069ca
1 changed files with 3 additions and 4 deletions
|
@ -83,10 +83,9 @@ impl NetInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut dev_line: Option<&str> = None;
|
let mut dev_line: Option<&str> = None;
|
||||||
for line in netdev_string.lines() {
|
for line in netdev_string.lines().map(|line| line.trim()) {
|
||||||
let trimmed_line = line.trim();
|
if line.starts_with(&self.dev_name) {
|
||||||
if trimmed_line.starts_with(&self.dev_name) {
|
dev_line = Some(line);
|
||||||
dev_line = Some(trimmed_line);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue