From fdff073c01e191e60a678125dd7501ff1be85eb7 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 6 Nov 2024 20:12:42 -0500 Subject: [PATCH] repo: Use ? in another place Just reading the code came across another place we just want to be using `?`. Signed-off-by: Colin Walters --- src/repository.rs | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/repository.rs b/src/repository.rs index 4cb6394..42a3114 100644 --- a/src/repository.rs +++ b/src/repository.rs @@ -553,20 +553,16 @@ impl Repository { OFlags::RDONLY | OFlags::DIRECTORY, )?; for item in Dir::new(dirfd)? { - match item { - Err(e) => Err(e)?, - Ok(entry) => { - let filename = entry.file_name(); - if filename != c"." && filename != c".." { - let mut value = Sha256HashValue::EMPTY; - value[0] = first_byte; - hex::decode_to_slice(filename.to_bytes(), &mut value[1..])?; - if !objects.contains(&value) { - println!("rm objects/{first_byte:02x}/{filename:?}"); - } else { - println!("# objects/{first_byte:02x}/{filename:?} lives"); - } - } + let entry = item?; + let filename = entry.file_name(); + if filename != c"." && filename != c".." { + let mut value = Sha256HashValue::EMPTY; + value[0] = first_byte; + hex::decode_to_slice(filename.to_bytes(), &mut value[1..])?; + if !objects.contains(&value) { + println!("rm objects/{first_byte:02x}/{filename:?}"); + } else { + println!("# objects/{first_byte:02x}/{filename:?} lives"); } } }