Skip to content

Commit f284e33

Browse files
various: clippy fixes
This patch is machine-generated.
1 parent c55fc83 commit f284e33

File tree

6 files changed

+17
-31
lines changed

6 files changed

+17
-31
lines changed

crates/composefs-oci/src/skopeo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<ObjectID: FsVerityHashValue> ImageOp<ObjectID> {
116116
MediaType::ImageLayerZstd => {
117117
split_async(ZstdDecoder::new(progress), &mut splitstream).await?;
118118
}
119-
other => bail!("Unsupported layer media type {:?}", other),
119+
other => bail!("Unsupported layer media type {other:?}"),
120120
};
121121
let layer_id = self.repo.write_stream(splitstream, None)?;
122122

crates/composefs-oci/src/tar.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -692,26 +692,22 @@ mod tests {
692692
assert_eq!(
693693
header.mode().unwrap(),
694694
stat.st_mode,
695-
"{}: mode mismatch",
696-
msg_prefix
695+
"{msg_prefix}: mode mismatch"
697696
);
698697
assert_eq!(
699698
header.uid().unwrap() as u32,
700699
stat.st_uid,
701-
"{}: uid mismatch",
702-
msg_prefix
700+
"{msg_prefix}: uid mismatch"
703701
);
704702
assert_eq!(
705703
header.gid().unwrap() as u32,
706704
stat.st_gid,
707-
"{}: gid mismatch",
708-
msg_prefix
705+
"{msg_prefix}: gid mismatch"
709706
);
710707
assert_eq!(
711708
header.mtime().unwrap() as i64,
712709
stat.st_mtim_sec,
713-
"{}: mtime mismatch",
714-
msg_prefix
710+
"{msg_prefix}: mtime mismatch"
715711
);
716712
}
717713
}

crates/composefs/src/dumpfile.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,15 +339,15 @@ pub fn add_entry_to_filesystem<ObjectID: FsVerityHashValue>(
339339
let parent = path.parent().unwrap_or_else(|| Path::new("/"));
340340
let filename = path
341341
.file_name()
342-
.ok_or_else(|| anyhow::anyhow!("Path has no filename: {:?}", path))?;
342+
.ok_or_else(|| anyhow::anyhow!("Path has no filename: {path:?}"))?;
343343

344344
// Get or create parent directory
345345
let parent_dir = if parent == Path::new("/") {
346346
&mut fs.root
347347
} else {
348348
fs.root
349349
.get_directory_mut(parent.as_os_str())
350-
.with_context(|| format!("Parent directory not found: {:?}", parent))?
350+
.with_context(|| format!("Parent directory not found: {parent:?}"))?
351351
};
352352

353353
// Convert the entry to an inode
@@ -360,7 +360,7 @@ pub fn add_entry_to_filesystem<ObjectID: FsVerityHashValue>(
360360
// Look up the target in our hardlinks map and clone the Rc
361361
let target_leaf = hardlinks
362362
.get(target.as_ref())
363-
.ok_or_else(|| anyhow::anyhow!("Hardlink target not found: {:?}", target))?
363+
.ok_or_else(|| anyhow::anyhow!("Hardlink target not found: {target:?}"))?
364364
.clone();
365365
Inode::Leaf(target_leaf)
366366
}
@@ -456,8 +456,8 @@ pub fn dumpfile_to_filesystem<ObjectID: FsVerityHashValue>(
456456
if line.trim().is_empty() {
457457
continue;
458458
}
459-
let entry = Entry::parse(line)
460-
.with_context(|| format!("Failed to parse dumpfile line: {}", line))?;
459+
let entry =
460+
Entry::parse(line).with_context(|| format!("Failed to parse dumpfile line: {line}"))?;
461461
add_entry_to_filesystem(&mut fs, entry, &mut hardlinks)?;
462462
}
463463

crates/composefs/src/dumpfile_parse.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -328,20 +328,12 @@ impl<'k> Xattr<'k> {
328328
let key = unescape_to_osstr(key)?;
329329
let keylen = key.as_bytes().len();
330330
if keylen > XATTR_NAME_MAX {
331-
anyhow::bail!(
332-
"xattr name too long; max={} found={}",
333-
XATTR_NAME_MAX,
334-
keylen
335-
);
331+
anyhow::bail!("xattr name too long; max={XATTR_NAME_MAX} found={keylen}");
336332
}
337333
let value = unescape(value)?;
338334
let valuelen = value.len();
339335
if valuelen > XATTR_SIZE_MAX {
340-
anyhow::bail!(
341-
"xattr value too long; max={} found={}",
342-
XATTR_SIZE_MAX,
343-
keylen
344-
);
336+
anyhow::bail!("xattr value too long; max={XATTR_SIZE_MAX} found={keylen}");
345337
}
346338
Ok(Self { key, value })
347339
}
@@ -440,7 +432,7 @@ impl<'p> Entry<'p> {
440432
unescape_to_path(payload.ok_or_else(|| anyhow!("Missing payload"))?)?;
441433
let targetlen = target.as_os_str().as_bytes().len();
442434
if targetlen > PATH_MAX as usize {
443-
anyhow::bail!("Target length too large {}", targetlen);
435+
anyhow::bail!("Target length too large {targetlen}");
444436
}
445437
Item::Symlink { nlink, target }
446438
}

crates/composefs/src/erofs/reader.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,7 @@ mod tests {
694694

695695
assert_eq!(
696696
found_names, expected_sorted,
697-
"Directory entries mismatch for nid {}",
698-
nid
697+
"Directory entries mismatch for nid {nid}"
699698
);
700699
}
701700

@@ -788,8 +787,7 @@ mod tests {
788787
// Add many files to force directory blocks
789788
for i in 0..100 {
790789
dumpfile.push_str(&format!(
791-
"/bigdir/file{:03} 5 100644 1 0 0 0 1000.0 - hello -\n",
792-
i
790+
"/bigdir/file{i:03} 5 100644 1 0 0 0 1000.0 - hello -\n"
793791
));
794792
}
795793

@@ -824,7 +822,7 @@ mod tests {
824822
// Build expected names
825823
let mut expected: Vec<String> = vec![".".to_string(), "..".to_string()];
826824
for i in 0..100 {
827-
expected.push(format!("file{:03}", i));
825+
expected.push(format!("file{i:03}"));
828826
}
829827
let expected_refs: Vec<&str> = expected.iter().map(|s| s.as_str()).collect();
830828

crates/composefs/src/fsverity/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ mod tests {
311311

312312
use super::*;
313313

314-
static TEMPDIR: Lazy<TempDir> = Lazy::new(|| tempdir());
314+
static TEMPDIR: Lazy<TempDir> = Lazy::new(tempdir);
315315
static TD_FD: Lazy<File> = Lazy::new(|| File::open(TEMPDIR.path()).unwrap());
316316

317317
fn tempfile() -> File {

0 commit comments

Comments
 (0)