Skip to content

Commit ad03d75

Browse files
committed
tree-wide: Use inline format! args in most places
I find this easier to read. Signed-off-by: Colin Walters <walters@verbum.org>
1 parent ebf3e30 commit ad03d75

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ fn generate_man_page<P: AsRef<Path>>(outdir: P, command: &str) -> io::Result<()>
3838
}
3939

4040
let outdir = outdir.as_ref();
41-
let outfile = outdir.join(format!("{}.1", command));
41+
let outfile = outdir.join(format!("{command}.1"));
4242
let cwd = env::current_dir()?;
43-
let txt_path = cwd.join("docs").join(format!("{}.1.txt", command));
43+
let txt_path = cwd.join("docs").join(format!("{command}.1.txt"));
4444

4545
let result = process::Command::new("asciidoctor")
4646
.arg("--doctype")

src/create.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ use super::utils::{
1212
use crate::{ArgMatches, KrunvmConfig, VmConfig, APP_NAME};
1313

1414
fn fix_resolv_conf(rootfs: &str, dns: &str) -> Result<(), std::io::Error> {
15-
let resolvconf_dir = format!("{}/etc/", rootfs);
15+
let resolvconf_dir = format!("{rootfs}/etc/");
1616
fs::create_dir_all(resolvconf_dir)?;
17-
let resolvconf = format!("{}/etc/resolv.conf", rootfs);
17+
let resolvconf = format!("{rootfs}/etc/resolv.conf");
1818
let mut file = fs::File::create(resolvconf)?;
1919
file.write_all(b"options use-vc\nnameserver ")?;
2020
file.write_all(dns.as_bytes())?;

src/start.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn map_volumes(_ctx: u32, vmcfg: &VmConfig, rootfs: &str) {
4545
fn map_volumes(ctx: u32, vmcfg: &VmConfig, rootfs: &str) {
4646
let mut volumes = Vec::new();
4747
for (host_path, guest_path) in vmcfg.mapped_volumes.iter() {
48-
let full_guest = format!("{}{}", &rootfs, guest_path);
48+
let full_guest = format!("{rootfs}{guest_path}");
4949
let full_guest_path = Path::new(&full_guest);
5050
if !full_guest_path.exists() {
5151
std::fs::create_dir(full_guest_path)
@@ -163,7 +163,7 @@ fn set_rlimits() {
163163
}
164164

165165
fn set_lock(rootfs: &str) -> File {
166-
let lock_path = format!("{}/.krunvm.lock", rootfs);
166+
let lock_path = format!("{rootfs}/.krunvm.lock");
167167
let file = File::create(lock_path).expect("Couldn't create lock file");
168168

169169
let ret = unsafe { libc::flock(file.as_raw_fd(), libc::LOCK_EX | libc::LOCK_NB) };

src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ pub fn get_buildah_args(cfg: &KrunvmConfig, cmd: BuildahCommand) -> Vec<String>
3030
hbpath.pop();
3131
hbpath.pop();
3232
let hbpath = hbpath.as_path().display();
33-
let policy_json = format!("{}/etc/containers/policy.json", hbpath);
34-
let registries_json = format!("{}/etc/containers/registries.conf", hbpath);
33+
let policy_json = format!("{hbpath}/etc/containers/policy.json");
34+
let registries_json = format!("{hbpath}/etc/containers/registries.conf");
3535
let storage_root = format!("{}/root", cfg.storage_volume);
3636
let storage_runroot = format!("{}/runroot", cfg.storage_volume);
3737

0 commit comments

Comments
 (0)