Skip to content

Commit

Permalink
repo: Use ? in another place
Browse files Browse the repository at this point in the history
Just reading the code came across another place we just want
to be using `?`.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters authored and allisonkarlitskaya committed Nov 7, 2024
1 parent 3cc7388 commit fdff073
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}
}
Expand Down

0 comments on commit fdff073

Please sign in to comment.