Skip to content

Commit

Permalink
🧹 make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
vnepogodin committed Sep 23, 2023
1 parent ccc14a5 commit 33113f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Data {
// Refill data
self.fill_installed_profiles();

set_matching_profiles(&mut self.pci_devices, &mut self.installed_pci_profiles, true);
set_matching_profiles(&mut self.pci_devices, &self.installed_pci_profiles, true);
}

fn fill_installed_profiles(&mut self) {
Expand All @@ -84,7 +84,7 @@ impl Data {

self.fill_all_profiles();

set_matching_profiles(&mut self.pci_devices, &mut self.all_pci_profiles, false);
set_matching_profiles(&mut self.pci_devices, &self.all_pci_profiles, false);

self.update_installed_profile_data();
}
Expand Down
8 changes: 6 additions & 2 deletions src/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,16 @@ fn parse_profile(node: &toml::Table, profile_name: &str) -> Result<Profile> {
}

fn parse_ids_file(file_path: &str) -> Result<String> {
use std::fmt::Write;

let file_content = fs::read_to_string(file_path)?;
let parsed_ids = file_content
.lines()
.filter(|x| !x.trim().is_empty() && x.trim().as_bytes()[0] != b'#')
.map(|x| format!(" {}", x.trim()))
.collect::<String>();
.fold(String::new(), |mut output, x| {
let _ = write!(output, " {}", x.trim());
output
});

Ok(parsed_ids.split_ascii_whitespace().collect::<Vec<_>>().join(" "))
}
Expand Down

0 comments on commit 33113f0

Please sign in to comment.