Skip to content

Commit 9a49cb2

Browse files
committed
commit: require result of verify functions to be used
1 parent d9161f0 commit 9a49cb2

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

commit_verify/src/commit.rs

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ where Self: Eq + Sized
4343
/// Verifies commitment against the message; default implementation just
4444
/// repeats the commitment to the message and check it against the `self`.
4545
#[inline]
46+
#[must_use = "the boolean inside Ok(_) must be used since it carries the result of the \
47+
validation"]
4648
fn verify(&self, msg: &Msg) -> bool { Self::commit(msg) == *self }
4749
}
4850

@@ -63,6 +65,8 @@ where Self: Eq + Sized
6365
/// just repeats the commitment to the message and check it against the
6466
/// `self`.
6567
#[inline]
68+
#[must_use = "the boolean inside Ok(_) must be used since it carries the result of the \
69+
validation"]
6670
fn try_verify(&self, msg: &Msg) -> Result<bool, Self::Error> {
6771
Ok(Self::try_commit(msg)? == *self)
6872
}

commit_verify/src/convolve.rs

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ where
6565
/// However if the proofs are provided by some sort of user/network input
6666
/// from an untrusted party, a proper form would be
6767
/// `if commitment.verify(...).unwrap_or(false) { .. }`.
68+
#[must_use = "the boolean inside Ok(_) must be used since it carries the result of the \
69+
validation"]
6870
fn verify(
6971
&self,
7072
msg: &Msg,

commit_verify/src/embed.rs

+2
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ where
148148
/// from an untrusted party, a proper form would be
149149
/// `if commitment.verify(...).unwrap_or(false) { .. }`.
150150
#[inline]
151+
#[must_use = "the boolean inside Ok(_) must be used since it carries the result of the \
152+
validation"]
151153
fn verify(&self, msg: &Msg, proof: &Self::Proof) -> Result<bool, Self::VerifyError>
152154
where
153155
Self: VerifyEq,

0 commit comments

Comments
 (0)