kata-sys-util: Fix needless_borrow warnings

As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to needless_borrow.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
Fabiano Fidêncio 2023-01-02 13:25:14 +01:00
parent c9c38e6d01
commit c1a8d89a72
3 changed files with 6 additions and 6 deletions

View File

@ -145,7 +145,7 @@ pub fn reflink_copy<S: AsRef<Path>, D: AsRef<Path>>(src: S, dst: D) -> Result<()
// Copy file using cp command, which handles sparse file copy.
fn do_regular_copy(src: &str, dst: &str) -> Result<()> {
let mut cmd = Command::new("/bin/cp");
cmd.args(&["--sparse=auto", src, dst]);
cmd.args(["--sparse=auto", src, dst]);
match cmd.output() {
Ok(output) => match output.status.success() {

View File

@ -820,11 +820,11 @@ mod tests {
let tmpdir2 = tempfile::tempdir().unwrap();
assert!(matches!(
bind_remount(&PathBuf::from(""), true),
bind_remount(PathBuf::from(""), true),
Err(Error::NullMountPointPath)
));
assert!(matches!(
bind_remount(&PathBuf::from("../______doesn't____exist____nnn"), true),
bind_remount(PathBuf::from("../______doesn't____exist____nnn"), true),
Err(Error::InvalidPath(_))
));
@ -1066,7 +1066,7 @@ mod tests {
.unwrap_err();
let src = path.join("src");
fs::write(&src, "test").unwrap();
fs::write(src, "test").unwrap();
let dst = path.join("dst");
fs::write(&dst, "test1").unwrap();
mount_at(

View File

@ -37,9 +37,9 @@ pub type Result<T> = std::result::Result<T, Error>;
lazy_static! {
static ref SYS_FS_PREFIX: PathBuf = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("test/texture");
// numa node file for UT, we can mock data
static ref NUMA_NODE_PATH: PathBuf = (&*SYS_FS_PREFIX).join("sys/devices/system/node");
static ref NUMA_NODE_PATH: PathBuf = (*SYS_FS_PREFIX).join("sys/devices/system/node");
// sysfs directory for CPU devices
static ref NUMA_CPU_PATH: PathBuf = (&*SYS_FS_PREFIX).join("sys/devices/system/cpu");
static ref NUMA_CPU_PATH: PathBuf = (*SYS_FS_PREFIX).join("sys/devices/system/cpu");
}
// global config in release