Skip to content

Commit e870e06

Browse files
committed
Do not check for < 0 for usize types
Clippy emits: error: this comparison involving the minimum or maximum element for this type contains a case that is always true or always false The vars `k` and `thresh` are both of type `uszie` and can never be below zero, use `==` instead.
1 parent 4d497dd commit e870e06

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/policy/concrete.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ impl<Pk: MiniscriptKey> Policy<Pk> {
343343
}
344344
}
345345
Policy::Threshold(k, ref subs) => {
346-
if k <= 0 || k > subs.len() {
346+
if k == 0 || k > subs.len() {
347347
Err(PolicyError::IncorrectThresh)
348348
} else {
349349
subs.iter()
@@ -621,7 +621,7 @@ where
621621
}
622622

623623
let thresh = expression::parse_num(top.args[0].name)?;
624-
if thresh >= nsubs || thresh <= 0 {
624+
if thresh >= nsubs || thresh == 0 {
625625
return Err(Error::PolicyError(PolicyError::IncorrectThresh));
626626
}
627627

0 commit comments

Comments
 (0)