From 6ce1e56d20adf36e3ac62a829caf9d10cbb1a52a Mon Sep 17 00:00:00 2001 From: David Gibson Date: Fri, 16 Apr 2021 16:28:29 +1000 Subject: [PATCH] agent/rustjail: Remove an unnecessary PathBuf PathBuf is an owned, mutable Path. We don't need those properties in get_value_from_cgroup() so we can use a Path instead. This may be slightly safer, and definitely stops clippy (version 1.51 at least) from complaining. fixes #1611 Signed-off-by: David Gibson --- src/agent/rustjail/src/cgroups/notifier.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/agent/rustjail/src/cgroups/notifier.rs b/src/agent/rustjail/src/cgroups/notifier.rs index 91c88be1f9..a3a7f4e855 100644 --- a/src/agent/rustjail/src/cgroups/notifier.rs +++ b/src/agent/rustjail/src/cgroups/notifier.rs @@ -8,7 +8,7 @@ use eventfd::{eventfd, EfdFlags}; use nix::sys::eventfd; use std::fs::{self, File}; use std::os::unix::io::{AsRawFd, FromRawFd}; -use std::path::{Path, PathBuf}; +use std::path::Path; use crate::pipestream::PipeStream; use futures::StreamExt as _; @@ -35,7 +35,7 @@ pub async fn notify_oom(cid: &str, cg_dir: String) -> Result> { // Flat keyed file format: // KEY0 VAL0\n // KEY1 VAL1\n -fn get_value_from_cgroup(path: &PathBuf, key: &str) -> Result { +fn get_value_from_cgroup(path: &Path, key: &str) -> Result { let content = fs::read_to_string(path)?; info!( sl!(),