fuzz: fix warnings, clippy lints, 1.48.0 failures

This commit is contained in:
Andrew Poelstra 2023-04-24 19:25:07 +00:00
parent fd88e48696
commit 933ecb19e1
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
11 changed files with 25 additions and 24 deletions

View File

@ -82,6 +82,7 @@ To build with the MSRV you will need to pin `serde` (if you have the feature ena
```
# serde 1.0.157 uses syn 2.0 which requires edition 2021
cargo update -p serde --precise 1.0.156
cargo update -p half --precise 1.7.1
```
before building. (And if your code is a library, your downstream users will need to run these

View File

@ -7,7 +7,7 @@ fn do_test(data: &[u8]) {
match tx_result {
Err(_) => {},
Ok(mut tx) => {
Ok(tx) => {
let ser = bitcoin::consensus::encode::serialize(&tx);
assert_eq!(&ser[..], data);
}

View File

@ -8,7 +8,7 @@ fn do_test(data: &[u8]) {
let w: Result<Witness, _> = deserialize(data);
if let Ok(witness) = w {
let serialized = serialize(&witness);
assert_eq!(data, serialized);
assert_eq!(data, &serialized[..]);
}
}

View File

@ -17,7 +17,7 @@ impl fmt::Write for NullWriter {
fn do_test(data: &[u8]) {
let mut writer = NullWriter;
bitcoin::Script::from_bytes(data).fmt_asm(&mut writer);
bitcoin::Script::from_bytes(data).fmt_asm(&mut writer).unwrap();
}
fn main() {

View File

@ -37,9 +37,9 @@ mod tests {
for (idx, c) in hex.as_bytes().iter().enumerate() {
b <<= 4;
match *c {
b'A'...b'F' => b |= c - b'A' + 10,
b'a'...b'f' => b |= c - b'a' + 10,
b'0'...b'9' => b |= c - b'0',
b'A'..=b'F' => b |= c - b'A' + 10,
b'a'..=b'f' => b |= c - b'a' + 10,
b'0'..=b'9' => b |= c - b'0',
_ => panic!("Bad hex"),
}
if (idx & 1) == 1 {

View File

@ -37,9 +37,9 @@ mod tests {
for (idx, c) in hex.as_bytes().iter().enumerate() {
b <<= 4;
match *c {
b'A'...b'F' => b |= c - b'A' + 10,
b'a'...b'f' => b |= c - b'a' + 10,
b'0'...b'9' => b |= c - b'0',
b'A'..=b'F' => b |= c - b'A' + 10,
b'a'..=b'f' => b |= c - b'a' + 10,
b'0'..=b'9' => b |= c - b'0',
_ => panic!("Bad hex"),
}
if (idx & 1) == 1 {

View File

@ -29,9 +29,9 @@ mod tests {
for (idx, c) in hex.as_bytes().iter().enumerate() {
b <<= 4;
match *c {
b'A'...b'F' => b |= c - b'A' + 10,
b'a'...b'f' => b |= c - b'a' + 10,
b'0'...b'9' => b |= c - b'0',
b'A'..=b'F' => b |= c - b'A' + 10,
b'a'..=b'f' => b |= c - b'a' + 10,
b'0'..=b'9' => b |= c - b'0',
_ => panic!("Bad hex"),
}
if (idx & 1) == 1 {

View File

@ -29,9 +29,9 @@ mod tests {
for (idx, c) in hex.as_bytes().iter().enumerate() {
b <<= 4;
match *c {
b'A'...b'F' => b |= c - b'A' + 10,
b'a'...b'f' => b |= c - b'a' + 10,
b'0'...b'9' => b |= c - b'0',
b'A'..=b'F' => b |= c - b'A' + 10,
b'a'..=b'f' => b |= c - b'a' + 10,
b'0'..=b'9' => b |= c - b'0',
_ => panic!("Bad hex"),
}
if (idx & 1) == 1 {

View File

@ -29,9 +29,9 @@ mod tests {
for (idx, c) in hex.as_bytes().iter().enumerate() {
b <<= 4;
match *c {
b'A'...b'F' => b |= c - b'A' + 10,
b'a'...b'f' => b |= c - b'a' + 10,
b'0'...b'9' => b |= c - b'0',
b'A'..=b'F' => b |= c - b'A' + 10,
b'a'..=b'f' => b |= c - b'a' + 10,
b'0'..=b'9' => b |= c - b'0',
_ => panic!("Bad hex"),
}
if (idx & 1) == 1 {

View File

@ -29,9 +29,9 @@ mod tests {
for (idx, c) in hex.as_bytes().iter().enumerate() {
b <<= 4;
match *c {
b'A'...b'F' => b |= c - b'A' + 10,
b'a'...b'f' => b |= c - b'a' + 10,
b'0'...b'9' => b |= c - b'0',
b'A'..=b'F' => b |= c - b'A' + 10,
b'a'..=b'f' => b |= c - b'a' + 10,
b'0'..=b'9' => b |= c - b'0',
_ => panic!("Bad hex"),
}
if (idx & 1) == 1 {

View File

@ -29,9 +29,9 @@ mod tests {
for (idx, c) in hex.as_bytes().iter().enumerate() {
b <<= 4;
match *c {
b'A'...b'F' => b |= c - b'A' + 10,
b'a'...b'f' => b |= c - b'a' + 10,
b'0'...b'9' => b |= c - b'0',
b'A'..=b'F' => b |= c - b'A' + 10,
b'a'..=b'f' => b |= c - b'a' + 10,
b'0'..=b'9' => b |= c - b'0',
_ => panic!("Bad hex"),
}
if (idx & 1) == 1 {