Skip to content

Commit

Permalink
Clean up error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Apr 8, 2024
1 parent b0ee678 commit 170bb8d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,13 @@ where

// If that didn't work, then copy and rm.
{
let parent = dest.parent();
if parent.is_none() {
return Err(Error::new(
let parent = dest.parent().ok_or_else(|| {
Error::new(
ErrorKind::NotFound,
"Could not get parent of dest!",
));
}
)
})?;

let parent = parent.unwrap();
fs::create_dir_all(parent)?
}

Expand Down

0 comments on commit 170bb8d

Please sign in to comment.