Skip to content

Commit

Permalink
style: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
bpetit committed Jan 26, 2024
1 parent fa679f2 commit 03e05c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/exporters/qemu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl QemuExporter {
trace!("Got {} processes to filter.", processes.len());
for vecp in processes.iter() {
if !vecp.is_empty() {
if let Some(pr) = vecp.get(0) {
if let Some(pr) = vecp.first() {
if let Some(res) = pr
.process
.cmdline
Expand Down
6 changes: 3 additions & 3 deletions src/sensors/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,12 @@ impl ProcessTracker {
) -> HashMap<String, String> {
let mut result = self.procs.iter().filter(
// get all processes that have process records
|x| !x.is_empty() && x.get(0).unwrap().process.pid == pid,
|x| !x.is_empty() && x.first().unwrap().process.pid == pid,
);
let process = result.next().unwrap();
let mut description = HashMap::new();
let regex_clean_container_id = Regex::new("[[:alnum:]]{12,}").unwrap();
if let Some(_p) = process.get(0) {
if let Some(_p) = process.first() {
// if we have the cgroups data from the original process struct
if let Ok(procfs_process) =
procfs::process::Process::new(pid.to_string().parse::<i32>().unwrap())
Expand Down Expand Up @@ -643,7 +643,7 @@ impl ProcessTracker {
.iter()
.filter(|x| !x.is_empty() && x.get(0).unwrap().process.pid == pid);
let process = result.next().unwrap();
if let Some(p) = process.get(0) {
if let Some(p) = process.first() {
let cmdline_request = p.process.cmdline(self);
if let Ok(mut cmdline_vec) = cmdline_request {
let mut cmdline = String::from("");
Expand Down

0 comments on commit 03e05c8

Please sign in to comment.