Use contains combinator instead of manual range
Clippy emits: warning: manual `RangeInclusive::contains` implementation As suggested, use `contains` combinator instead of manual range check.
This commit is contained in:
parent
b7d6c3e02c
commit
14c72e755b
|
@ -524,7 +524,7 @@ impl Script {
|
|||
// special meaning. The value of the first push is called the "version byte". The following
|
||||
// byte vector pushed is called the "witness program".
|
||||
let script_len = self.0.len();
|
||||
if script_len < 4 || script_len > 42 {
|
||||
if !(4..=42).contains(&script_len) {
|
||||
return false
|
||||
}
|
||||
let ver_opcode = opcodes::All::from(self.0[0]); // Version 0 or PUSHNUM_1-PUSHNUM_16
|
||||
|
@ -876,7 +876,7 @@ impl Builder {
|
|||
/// dedicated opcodes to push some small integers.
|
||||
pub fn push_int(self, data: i64) -> Builder {
|
||||
// We can special-case -1, 1-16
|
||||
if data == -1 || (data >= 1 && data <= 16) {
|
||||
if data == -1 || (1..=16).contains(&data) {
|
||||
let opcode = opcodes::All::from(
|
||||
(data - 1 + opcodes::OP_TRUE.into_u8() as i64) as u8
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue