Skip to content

Commit

Permalink
More clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Apr 7, 2024
1 parent 2ef6407 commit 079738a
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ pub fn run(cli: args::Args) -> Result<(), Error> {
// If the user wishes to restore everything
if cli.decompose {
if cli.force || util::prompt_yes("Really unlink the entire graveyard?") {
if let Err(e) = fs::remove_dir_all(graveyard) {
return Err(Error::new(e.kind(), "Couldn't unlink graveyard"));
}
fs::remove_dir_all(graveyard)?;
}
return Ok(());
}
Expand Down Expand Up @@ -121,14 +119,14 @@ pub fn run(cli: args::Args) -> Result<(), Error> {
}

// Reopen the record and then delete lines corresponding to exhumed graves
if let Err(e) = fs::File::open(record)
fs::File::open(record)
.and_then(|f| delete_lines_from_record(f, record, &graves_to_exhume))
{
return Err(Error::new(
e.kind(),
format!("Failed to remove unburied files from record: {}", e),
));
}
.map_err(|e| {
Error::new(
e.kind(),
format!("Failed to remove unburied files from record: {}", e),
)
})?;
return Ok(());
}

Expand Down

0 comments on commit 079738a

Please sign in to comment.