Skip to content

Commit

Permalink
error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
sharunkumar committed Mar 24, 2024
1 parent efafe72 commit bf5c2af
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ fn move_file(from: PathBuf, to: PathBuf) -> Result<(), std::io::Error> {
fs::rename(&from, &to).or_else(|_| {
// try copy and delete if that does not work
fs::copy(&from, &to).and_then(|_| {
fs::remove_file(&from).unwrap();
Ok(())
fs::remove_file(&from).and_then(|_| Ok(()))
})
})
}
Expand Down

0 comments on commit bf5c2af

Please sign in to comment.