Skip to content

Commit

Permalink
refactor: prefer map_err
Browse files Browse the repository at this point in the history
  • Loading branch information
KSXGitHub committed Nov 22, 2024
1 parent 15b3db9 commit b684752
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ impl Task for AsyncReflink {
type JsValue = JsNumber;

fn compute(&mut self) -> Result<Self::Output> {
match reflink_file_sync(&self.src, &self.dst) {
Ok(_) => Ok(()),
Err(err) => Err(Error::from_reason(format!(
reflink_file_sync(&self.src, &self.dst).map_err(|err| {
Error::from_reason(format!(
"{err}, reflink '{src}' -> '{dst}'",
src = self.src,
dst = self.dst,
))),
}
))
})
}

fn resolve(&mut self, env: Env, _: ()) -> Result<Self::JsValue> {
Expand Down

0 comments on commit b684752

Please sign in to comment.