rust: Use inline format! variables in a few places

Since our MSRV now supports it.
This commit is contained in:
Colin Walters 2022-06-09 17:51:07 -04:00
parent 76071a2b11
commit 93e3784b66
3 changed files with 7 additions and 7 deletions

View File

@ -86,7 +86,7 @@ mod tests {
#[test]
fn should_stringify_object_name() {
let object_name = ObjectName::new("abcdef123456", ObjectType::DirTree);
let stringified = format!("{}", object_name);
let stringified = format!("{object_name}");
assert_eq!(stringified, "abcdef123456.dirtree");
}

View File

@ -363,7 +363,7 @@ fn impl_transaction_test<M: AsRef<str>>(
booted: booted_commit.to_string(),
orig: sysrepo_obj.resolve_rev(ORIGREF, false)?.unwrap().into(),
prev: srvrepo_obj
.resolve_rev(&format!("{}^", TESTREF), false)?
.resolve_rev(&format!("{TESTREF}^"), false)?
.unwrap()
.into(),
target: srvrepo_obj.resolve_rev(TESTREF, false)?.unwrap().into(),
@ -568,7 +568,7 @@ pub(crate) fn itest_transactionality() -> Result<()> {
..Default::default()
};
with_webserver_in(&srvrepo, &webserver_opts, move |addr| {
let url = format!("http://{}", addr);
let url = format!("http://{addr}");
bash!(
"ostree remote delete --if-exists testrepo
ostree remote add --set=gpg-verify=false testrepo ${url}",

View File

@ -31,9 +31,9 @@ pub(crate) fn mkvroot<P: AsRef<Path>>(p: P, v: u32) -> Result<()> {
std::fs::create_dir_all(p.join(v))?;
}
let verpath = p.join("etc/.mkrootversion");
write_file(&verpath, &format!("{}", v))?;
write_file(p.join("usr/bin/somebinary"), &format!("somebinary v{}", v))?;
write_file(p.join("etc/someconf"), &format!("someconf v{}", v))?;
write_file(&verpath, &format!("{v}"))?;
write_file(p.join("usr/bin/somebinary"), &format!("somebinary v{v}"))?;
write_file(p.join("etc/someconf"), &format!("someconf v{v}"))?;
write_file(p.join("usr/bin/vmod2"), &format!("somebinary v{}", v % 2))?;
write_file(p.join("usr/bin/vmod3"), &format!("somebinary v{}", v % 3))?;
Ok(())
@ -134,7 +134,7 @@ pub(crate) fn update_os_tree<P: AsRef<Path>>(
tempdir.ensure_dir(v, 0o755)?;
let dest = tempdir.sub_dir(v)?;
mutated += mutate_executables_to(&src, &dest, percentage)
.with_context(|| format!("Replacing binaries in {}", v))?;
.with_context(|| format!("Replacing binaries in {v}"))?;
}
}
}