summaryrefslogtreecommitdiffstats
path: root/src/app/data_harvester
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2021-06-18 15:35:19 -0700
committerGitHub <noreply@github.com>2021-06-18 18:35:19 -0400
commite3ebc48ce86228f005768740c257870a515089bb (patch)
tree1e5841b1f7fe52cfb02c485bb813a6acbd69cfea /src/app/data_harvester
parent5d3d96dead1b76c1bc35f57b4151891f8d280633 (diff)
refactor: Fix clippy lint for entry vacancy check (#503)
Diffstat (limited to 'src/app/data_harvester')
-rw-r--r--src/app/data_harvester/processes/linux.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/app/data_harvester/processes/linux.rs b/src/app/data_harvester/processes/linux.rs
index d6778ba3..79c77190 100644
--- a/src/app/data_harvester/processes/linux.rs
+++ b/src/app/data_harvester/processes/linux.rs
@@ -1,5 +1,7 @@
//! Process data collection for Linux.
+use std::collections::hash_map::Entry;
+
use crate::utils::error::{self, BottomError};
use crate::Pid;
@@ -232,9 +234,9 @@ pub fn get_process_data(
if let Ok(dir) = dir {
if let Ok(pid) = dir.file_name().to_string_lossy().trim().parse::<Pid>() {
let mut fresh = false;
- if !pid_mapping.contains_key(&pid) {
+ if let Entry::Vacant(entry) = pid_mapping.entry(pid) {
if let Ok(ppd) = PrevProcDetails::new(pid) {
- pid_mapping.insert(pid, ppd);
+ entry.insert(ppd);
fresh = true;
} else {
// Bail early.