From 6d5157b0011c3d6d3f2785c49c05128eeb99bb75 Mon Sep 17 00:00:00 2001 From: Travis Sturzl Date: Sun, 23 May 2021 20:21:01 -0600 Subject: [PATCH] we only need the first result --- src/cgroups/manager.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/cgroups/manager.rs b/src/cgroups/manager.rs index b971ef7fa..1215ec0d8 100644 --- a/src/cgroups/manager.rs +++ b/src/cgroups/manager.rs @@ -62,17 +62,13 @@ impl Manager { let mount = Process::myself()? .mountinfo()? .into_iter() - .filter(|m| m.fs_type == "cgroup" && m.mount_point.ends_with(subsystem)) - .collect::>() - .pop() + .find(|m| m.fs_type == "cgroup" && m.mount_point.ends_with(subsystem)) .unwrap(); let cgroup = Process::myself()? .cgroups()? .into_iter() - .filter(|c| c.controllers.contains(&subsystem.to_owned())) - .collect::>() - .pop() + .find(|c| c.controllers.contains(&subsystem.to_owned())) .unwrap(); let p = if cgroup_path.to_string_lossy().into_owned().is_empty() {