Skip to content

Commit 75adc8b

Browse files
various: nightly clippy fixes
Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
1 parent 124d4f5 commit 75adc8b

File tree

7 files changed

+13
-14
lines changed

7 files changed

+13
-14
lines changed

crates/composefs-oci/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub fn ls_layer<ObjectID: FsVerityHashValue>(
3838
let mut split_stream = repo.open_stream(name, None)?;
3939

4040
while let Some(entry) = get_entry(&mut split_stream)? {
41-
println!("{}", entry);
41+
println!("{entry}");
4242
}
4343

4444
Ok(())
@@ -388,7 +388,7 @@ mod test {
388388
let mut dump = String::new();
389389
let mut split_stream = repo.open_stream("refs/name", Some(&id)).unwrap();
390390
while let Some(entry) = tar::get_entry(&mut split_stream).unwrap() {
391-
writeln!(dump, "{}", entry).unwrap();
391+
writeln!(dump, "{entry}").unwrap();
392392
}
393393
similar_asserts::assert_eq!(dump, "\
394394
/file0 0 100700 1 0 0 0 0.0 - - -

crates/composefs/src/dumpfile.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fn write_escaped(writer: &mut impl fmt::Write, bytes: &[u8]) -> fmt::Result {
2929
let c = *c;
3030

3131
if c < b'!' || c == b'=' || c == b'\\' || c > b'~' {
32-
write!(writer, "\\x{:02x}", c)?;
32+
write!(writer, "\\x{c:02x}")?;
3333
} else {
3434
writer.write_char(c as char)?;
3535
}
@@ -66,7 +66,7 @@ fn write_entry(
6666
write_escaped(writer, content)?;
6767
write!(writer, " ")?;
6868
if let Some(id) = digest {
69-
write!(writer, "{}", id)?;
69+
write!(writer, "{id}")?;
7070
} else {
7171
write_empty(writer)?;
7272
}
@@ -212,7 +212,7 @@ struct DumpfileWriter<'a, W: Write, ObjectID: FsVerityHashValue> {
212212
fn writeln_fmt(writer: &mut impl Write, f: impl Fn(&mut String) -> fmt::Result) -> Result<()> {
213213
let mut tmp = String::with_capacity(256);
214214
f(&mut tmp)?;
215-
Ok(writeln!(writer, "{}", tmp)?)
215+
Ok(writeln!(writer, "{tmp}")?)
216216
}
217217

218218
impl<'a, W: Write, ObjectID: FsVerityHashValue> DumpfileWriter<'a, W, ObjectID> {

crates/composefs/src/dumpfile_parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ fn escape<W: std::fmt::Write>(out: &mut W, s: &[u8], mode: EscapeMode) -> std::f
291291
b'\n' => out.write_str(r"\n")?,
292292
b'\t' => out.write_str(r"\t")?,
293293
b'\r' => out.write_str(r"\r")?,
294-
o => write!(out, "\\x{:02x}", o)?,
294+
o => write!(out, "\\x{o:02x}")?,
295295
}
296296
}
297297
}

crates/composefs/src/erofs/debug.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ macro_rules! write_fields {
4747

4848
fn utf8_or_hex(data: &[u8]) -> String {
4949
if let Ok(string) = std::str::from_utf8(data) {
50-
format!("{:?}", string)
50+
format!("{string:?}")
5151
} else {
5252
hex::encode(data)
5353
}
@@ -322,8 +322,7 @@ impl<T: fmt::Debug + InodeHeader> fmt::Debug for Inode<T> {
322322
let offset = addr!(dir) - addr!(self);
323323
return write!(
324324
f,
325-
" +{offset:02x} --- inline directory entries ---{:#?}",
326-
dir
325+
" +{offset:02x} --- inline directory entries ---{dir:#?}"
327326
);
328327
}
329328

crates/composefs/src/repository.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ impl<ObjectID: FsVerityHashValue> Repository<ObjectID> {
324324
name: &str,
325325
verity: Option<&ObjectID>,
326326
) -> Result<SplitStreamReader<File, ObjectID>> {
327-
let filename = format!("streams/{}", name);
327+
let filename = format!("streams/{name}");
328328

329329
let file = File::from(if let Some(verity_hash) = verity {
330330
self.open_with_verity(&filename, verity_hash)?
@@ -365,7 +365,7 @@ impl<ObjectID: FsVerityHashValue> Repository<ObjectID> {
365365
self.ensure_symlink(&image_path, &object_path)?;
366366

367367
if let Some(reference) = name {
368-
let ref_path = format!("images/refs/{}", reference);
368+
let ref_path = format!("images/refs/{reference}");
369369
self.symlink(&ref_path, &image_path)?;
370370
}
371371

@@ -380,7 +380,7 @@ impl<ObjectID: FsVerityHashValue> Repository<ObjectID> {
380380
}
381381

382382
pub fn open_image(&self, name: &str) -> Result<OwnedFd> {
383-
let image = self.openat(&format!("images/{}", name), OFlags::RDONLY)?;
383+
let image = self.openat(&format!("images/{name}"), OFlags::RDONLY)?;
384384

385385
if !name.contains("/") {
386386
// A name with no slashes in it is taken to be a sha256 fs-verity digest

crates/composefs/src/splitstream.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ impl<F: Read, ObjectID: FsVerityHashValue> Read for SplitStreamReader<F, ObjectI
392392
Ok(n_bytes)
393393
}
394394
Ok(ChunkType::External(..)) => unreachable!(),
395-
Err(e) => Err(std::io::Error::new(std::io::ErrorKind::Other, e)),
395+
Err(e) => Err(std::io::Error::other(e)),
396396
}
397397
}
398398
}

crates/composefs/src/tree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ mod tests {
587587
}
588588
match dir.get_file(OsStr::new("link.txt")) {
589589
Err(ImageError::IsNotRegular(name)) => assert_eq!(name.to_str().unwrap(), "link.txt"),
590-
res => panic!("Expected IsNotRegular, got {:?}", res),
590+
res => panic!("Expected IsNotRegular, got {res:?}"),
591591
}
592592
}
593593

0 commit comments

Comments
 (0)