diff --git a/src/kill.rs b/src/kill.rs index 7d028de..c57b33a 100644 --- a/src/kill.rs +++ b/src/kill.rs @@ -23,17 +23,7 @@ pub fn choose_victim( let mut processes = fs::read_dir("/proc/")? .filter_map(|e| e.ok()) - .filter_map(|entry| { - entry - .path() - .file_name() - .unwrap_or_else(|| OsStr::new("0")) - .to_str() - .unwrap_or("0") - .trim() - .parse::() - .ok() - }) + .filter_map(|entry| entry.file_name().to_str()?.trim().parse::().ok()) .filter(|pid| *pid > 1) .filter_map(|pid| Process::from_pid(pid, proc_buf).ok());