From ebe5ff4ce31c161b06e45d656b482d6a48c2a818 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 28 Feb 2024 17:17:04 -0500 Subject: [PATCH] tree-wide: Use inline `format!` args in most places I find this easier to read. Signed-off-by: Colin Walters --- build.rs | 4 ++-- src/commands/start.rs | 4 ++-- src/utils.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.rs b/build.rs index d7a571a..e7e71ef 100644 --- a/build.rs +++ b/build.rs @@ -38,9 +38,9 @@ fn generate_man_page>(outdir: P, command: &str) -> io::Result<()> } let outdir = outdir.as_ref(); - let outfile = outdir.join(format!("{}.1", command)); + let outfile = outdir.join(format!("{command}.1")); let cwd = env::current_dir()?; - let txt_path = cwd.join("docs").join(format!("{}.1.txt", command)); + let txt_path = cwd.join("docs").join(format!("{command}.1.txt")); let result = process::Command::new("asciidoctor") .arg("--doctype") diff --git a/src/commands/start.rs b/src/commands/start.rs index 2d67423..51182ad 100644 --- a/src/commands/start.rs +++ b/src/commands/start.rs @@ -100,7 +100,7 @@ fn map_volumes(_ctx: u32, vmcfg: &VmConfig, rootfs: &str) { fn map_volumes(ctx: u32, vmcfg: &VmConfig, rootfs: &str) { let mut volumes = Vec::new(); for (host_path, guest_path) in vmcfg.mapped_volumes.iter() { - let full_guest = format!("{}{}", &rootfs, guest_path); + let full_guest = format!("{rootfs}{guest_path}"); let full_guest_path = Path::new(&full_guest); if !full_guest_path.exists() { std::fs::create_dir(full_guest_path) @@ -218,7 +218,7 @@ fn set_rlimits() { } fn set_lock(rootfs: &str) -> File { - let lock_path = format!("{}/.krunvm.lock", rootfs); + let lock_path = format!("{rootfs}/.krunvm.lock"); let file = File::create(lock_path).expect("Couldn't create lock file"); let ret = unsafe { libc::flock(file.as_raw_fd(), libc::LOCK_EX | libc::LOCK_NB) }; diff --git a/src/utils.rs b/src/utils.rs index 8b3d5b2..2328263 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -33,8 +33,8 @@ pub fn get_buildah_args(cfg: &KrunvmConfig, cmd: BuildahCommand) -> Vec hbpath.pop(); hbpath.pop(); let hbpath = hbpath.as_path().display(); - let policy_json = format!("{}/etc/containers/policy.json", hbpath); - let registries_json = format!("{}/etc/containers/registries.conf", hbpath); + let policy_json = format!("{hbpath}/etc/containers/policy.json"); + let registries_json = format!("{hbpath}/etc/containers/registries.conf"); let storage_root = format!("{}/root", cfg.storage_volume); let storage_runroot = format!("{}/runroot", cfg.storage_volume);