diff --git a/src/exporters/qemu.rs b/src/exporters/qemu.rs index de3355e5..5ed27073 100644 --- a/src/exporters/qemu.rs +++ b/src/exporters/qemu.rs @@ -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 diff --git a/src/sensors/utils.rs b/src/sensors/utils.rs index 1827d054..f3b5de7f 100644 --- a/src/sensors/utils.rs +++ b/src/sensors/utils.rs @@ -449,12 +449,12 @@ impl ProcessTracker { ) -> HashMap { 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::().unwrap()) @@ -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("");