some changes

This commit is contained in:
2024-12-30 19:38:37 +00:00
parent 7095a197c6
commit 1dbd53a347
2 changed files with 3 additions and 3 deletions
+1
View File
@@ -1,4 +1,5 @@
#![allow(clippy::module_inception)]
#![allow(clippy::module_name_repetitions)]
mod handle;
mod memory;
+2 -3
View File
@@ -21,15 +21,14 @@ pub enum Identifier {
impl Process {
pub fn from(identifier: &Identifier) -> Result<Self, crate::Error> {
let snapshot = match identifier {
let Some(snapshot) = (match identifier {
Identifier::Id(pid) => ProcessSnapshot::get_processes()?
.into_iter()
.find(|snapshot| snapshot.id == *pid),
Identifier::Name(ref name) => ProcessSnapshot::get_processes()?
.into_iter()
.find(|snapshot| snapshot.name == *name),
};
let Some(snapshot) = snapshot else {
}) else {
return Err(crate::Error::ProcessError(format!(
"failed to find a process with identifier `{identifier}`",
)));