diff --git a/src/rootfs/mount.rs b/src/rootfs/mount.rs index 78a988ba06..0fe752d35b 100644 --- a/src/rootfs/mount.rs +++ b/src/rootfs/mount.rs @@ -5,13 +5,19 @@ use super::{ use crate::syscall::{syscall::create_syscall, Syscall}; use crate::utils::PathBufExt; use anyhow::{bail, Context, Result}; -use cgroups::common::{CgroupSetup::{Hybrid, Legacy, Unified}, DEFAULT_CGROUP_ROOT}; +use cgroups::common::{ + CgroupSetup::{Hybrid, Legacy, Unified}, + DEFAULT_CGROUP_ROOT, +}; use nix::{errno::Errno, mount::MsFlags}; use oci_spec::runtime::{Mount as SpecMount, MountBuilder as SpecMountBuilder}; use procfs::process::{MountOptFields, Process}; -use std::{collections::HashMap, fs::{canonicalize, create_dir_all, OpenOptions}}; -use std::path::{Path, PathBuf}; use std::borrow::Cow; +use std::path::{Path, PathBuf}; +use std::{ + collections::HashMap, + fs::{canonicalize, create_dir_all, OpenOptions}, +}; #[derive(Debug)] pub struct MountOptions<'a> { diff --git a/src/rootfs/symlink.rs b/src/rootfs/symlink.rs index f878eb13ca..0ebd491646 100644 --- a/src/rootfs/symlink.rs +++ b/src/rootfs/symlink.rs @@ -15,13 +15,11 @@ impl Default for Symlink { impl Symlink { pub fn new() -> Symlink { - Symlink::with_syscall(create_syscall()) + Symlink::with_syscall(create_syscall()) } fn with_syscall(syscall: Box) -> Symlink { - Symlink { - syscall, - } + Symlink { syscall } } // Create symlinks for subsystems that have been comounted e.g. cpu -> cpu,cpuacct, cpuacct -> cpu,cpuacct @@ -86,8 +84,8 @@ impl Symlink { mod tests { use super::*; use crate::syscall::linux::LinuxSyscall; - use crate::{syscall::test::TestHelperSyscall, utils::create_temp_dir}; use crate::utils::TempDir; + use crate::{syscall::test::TestHelperSyscall, utils::create_temp_dir}; use nix::{ fcntl::{open, OFlag}, sys::stat::Mode, @@ -178,7 +176,9 @@ mod tests { let symlink = Symlink::with_syscall(Box::new(LinuxSyscall)); // act - symlink.setup_comount_symlinks(&tmp, "cpu,cpuacct").context("failed to setup symlinks")?; + symlink + .setup_comount_symlinks(&tmp, "cpu,cpuacct") + .context("failed to setup symlinks")?; // assert assert!(cpu.exists(), "cpu symlink does not exist"); @@ -214,8 +214,9 @@ mod tests { let symlink = Symlink::with_syscall(Box::new(LinuxSyscall)); // act - let result = - symlink.setup_comount_symlinks(&tmp, "memory,task").context("failed to setup symlinks"); + let result = symlink + .setup_comount_symlinks(&tmp, "memory,task") + .context("failed to setup symlinks"); // assert assert!(result.is_ok());