Skip to content

Commit dacd94f

Browse files
committed
use ok_or_else
1 parent 8ba37a1 commit dacd94f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/encoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ impl<H: Hasher> SdObjectEncoder<H> {
8585
.get_mut(&mut self.object)
8686
.map_err(|_| Error::InvalidPath(path.to_string()))?
8787
.as_object_mut()
88-
.ok_or(Error::InvalidPath(path.to_string()))?;
88+
.ok_or_else(|| Error::InvalidPath(path.to_string()))?;
8989

9090
// Remove the value from the parent and create a disclosure for it.
9191
let disclosure = Disclosure::new(
9292
salt,
9393
Some(element_key.to_owned()),
9494
parent
9595
.remove(&element_key)
96-
.ok_or(Error::InvalidPath(path.to_string()))?,
96+
.ok_or_else(|| Error::InvalidPath(path.to_string()))?,
9797
);
9898

9999
// Hash the disclosure.

0 commit comments

Comments
 (0)