Skip to content

Commit

Permalink
use ok_or_else
Browse files Browse the repository at this point in the history
  • Loading branch information
UMR1352 committed Sep 23, 2024
1 parent 8ba37a1 commit dacd94f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ impl<H: Hasher> SdObjectEncoder<H> {
.get_mut(&mut self.object)
.map_err(|_| Error::InvalidPath(path.to_string()))?
.as_object_mut()
.ok_or(Error::InvalidPath(path.to_string()))?;
.ok_or_else(|| Error::InvalidPath(path.to_string()))?;

// Remove the value from the parent and create a disclosure for it.
let disclosure = Disclosure::new(
salt,
Some(element_key.to_owned()),
parent
.remove(&element_key)
.ok_or(Error::InvalidPath(path.to_string()))?,
.ok_or_else(|| Error::InvalidPath(path.to_string()))?,
);

// Hash the disclosure.
Expand Down

0 comments on commit dacd94f

Please sign in to comment.