mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-24 06:05:10 +02:00
refactor: Fix clippy lint for entry vacancy check (#503)
This commit is contained in:
parent
5d3d96dead
commit
e3ebc48ce8
@ -1,5 +1,7 @@
|
|||||||
//! Process data collection for Linux.
|
//! Process data collection for Linux.
|
||||||
|
|
||||||
|
use std::collections::hash_map::Entry;
|
||||||
|
|
||||||
use crate::utils::error::{self, BottomError};
|
use crate::utils::error::{self, BottomError};
|
||||||
use crate::Pid;
|
use crate::Pid;
|
||||||
|
|
||||||
@ -232,9 +234,9 @@ pub fn get_process_data(
|
|||||||
if let Ok(dir) = dir {
|
if let Ok(dir) = dir {
|
||||||
if let Ok(pid) = dir.file_name().to_string_lossy().trim().parse::<Pid>() {
|
if let Ok(pid) = dir.file_name().to_string_lossy().trim().parse::<Pid>() {
|
||||||
let mut fresh = false;
|
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) {
|
if let Ok(ppd) = PrevProcDetails::new(pid) {
|
||||||
pid_mapping.insert(pid, ppd);
|
entry.insert(ppd);
|
||||||
fresh = true;
|
fresh = true;
|
||||||
} else {
|
} else {
|
||||||
// Bail early.
|
// Bail early.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user