Skip to content

Commit c8a6328

Browse files
allisonkarlitskayacgwalters
authored andcommitted
various: new clippy, new fixups!
Some of these are longstanding nags, others are nice suggestions from the incoming clippy version in our CI container. Signed-off-by: Allison Karlitskaya <[email protected]>
1 parent 7fe9137 commit c8a6328

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

src/dumpfile_parse.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -891,8 +891,9 @@ mod tests {
891891
mkcomposefs(SPECIAL_DUMP, &mut tmpf).unwrap();
892892
let mut entries = String::new();
893893
tmpf.seek(std::io::SeekFrom::Start(0))?;
894-
let mut filter = DumpConfig::default();
895-
filter.filters = Some(&["blockdev", "inline"]);
894+
let filter = DumpConfig {
895+
filters: Some(&["blockdev", "inline"]),
896+
};
896897
dump(tmpf, filter, |e| {
897898
writeln!(entries, "{e}")?;
898899
Ok(())

src/erofs/debug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ fn hexdump(f: &mut impl fmt::Write, data: &[u8], rel: usize) -> fmt::Result {
250250
};
251251
let end = start + data.len();
252252
let start_row = start / 16;
253-
let end_row = (end + 15) / 16;
253+
let end_row = end.div_ceil(16);
254254

255255
for row in start_row..end_row {
256256
let row_start = row * 16;

src/erofs/writer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,9 @@ impl<'a> Directory<'a> {
251251
}
252252

253253
fn inode_meta(&self, block_offset: usize) -> (format::DataLayout, u32, u64, usize) {
254-
let (layout, u) = if self.inline.len() == 0 {
254+
let (layout, u) = if self.inline.is_empty() {
255255
(format::DataLayout::FlatPlain, block_offset as u32 / 4096)
256-
} else if self.blocks.len() > 0 {
256+
} else if !self.blocks.is_empty() {
257257
(format::DataLayout::FlatInline, block_offset as u32 / 4096)
258258
} else {
259259
(format::DataLayout::FlatInline, 0)

src/fsverity/ioctl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ mod tests {
152152
#[test]
153153
fn test_fs_ioc_enable_verity_wrong_fs() {
154154
let file = tempfile_in("/dev/shm").unwrap();
155-
let fd = OwnedFd::try_from(file).unwrap();
155+
let fd = OwnedFd::from(file);
156156
let res = fs_ioc_enable_verity::<&OwnedFd, Sha256HashValue>(&fd);
157157
let err = res.err().unwrap();
158158
assert_eq!(err, EnableVerifyError::FilesystemNotSupported);

tests/repo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn test_layer() -> Result<()> {
4646
let layer_id: [u8; 32] = context.finalize().into();
4747

4848
let tmpfile = tempfile::TempDir::with_prefix_in("composefs-test-", test_global_tmpdir()?)?;
49-
let repo = Repository::open_path(CWD, tmpfile.path().to_path_buf())?;
49+
let repo = Repository::open_path(CWD, tmpfile.path())?;
5050
let id = oci::import_layer(&repo, &layer_id, Some("name"), &mut layer.as_slice())?;
5151

5252
let mut dump = String::new();

0 commit comments

Comments
 (0)