Skip to content

Commit

Permalink
Remove Matcher::KeyValue match laziness
Browse files Browse the repository at this point in the history
Closes #316
  • Loading branch information
exincore committed Jul 10, 2022
1 parent 01ed4ee commit b59b672
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions os_info/src/matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ impl Matcher {
fn find_by_key<'a>(string: &'a str, key: &str) -> Option<&'a str> {
let key = [key, "="].concat();
for line in string.lines() {
if let Some(key_start) = line.find(&key) {
return Some(
line[key_start + key.len()..].trim_matches(|c: char| c == '"' || c.is_whitespace()),
);
if line.starts_with(&key) {
return Some(line[key.len()..].trim_matches(|c: char| c == '"' || c.is_whitespace()));
}
}

Expand Down

0 comments on commit b59b672

Please sign in to comment.