chore: Fix lint warnings for all targets (#240)
This commit is contained in:
parent
2f1270f8e8
commit
381a46f2cf
15 changed files with 93 additions and 94 deletions
|
|
@ -96,10 +96,10 @@ mod tests {
|
|||
for (idx, (block_str, jsonl_str)) in test_blocks.iter().enumerate() {
|
||||
println!("decoding json block {}", idx + 1);
|
||||
|
||||
let bytes = hex::decode(block_str).expect(&format!("bad block file {idx}"));
|
||||
let bytes = hex::decode(block_str).unwrap_or_else(|_| panic!("bad block file {idx}"));
|
||||
|
||||
let (_, block): BlockWrapper =
|
||||
minicbor::decode(&bytes[..]).expect(&format!("error decoding cbor for file {idx}"));
|
||||
let (_, block): BlockWrapper = minicbor::decode(&bytes[..])
|
||||
.unwrap_or_else(|_| panic!("error decoding cbor for file {idx}"));
|
||||
|
||||
let mut datums = jsonl_str.lines();
|
||||
|
||||
|
|
@ -126,10 +126,10 @@ mod tests {
|
|||
for (idx, (block_str, jsonl_str)) in test_blocks.iter().enumerate() {
|
||||
println!("decoding json block {}", idx + 1);
|
||||
|
||||
let bytes = hex::decode(block_str).expect(&format!("bad block file {idx}"));
|
||||
let bytes = hex::decode(block_str).unwrap_or_else(|_| panic!("bad block file {idx}"));
|
||||
|
||||
let (_, block): BlockWrapper =
|
||||
minicbor::decode(&bytes[..]).expect(&format!("error decoding cbor for file {idx}"));
|
||||
let (_, block): BlockWrapper = minicbor::decode(&bytes[..])
|
||||
.unwrap_or_else(|_| panic!("error decoding cbor for file {idx}"));
|
||||
|
||||
let mut scripts = jsonl_str.lines();
|
||||
|
||||
|
|
|
|||
|
|
@ -1623,12 +1623,13 @@ mod tests {
|
|||
|
||||
for (idx, block_str) in test_blocks.iter().enumerate() {
|
||||
println!("decoding test block {}", idx + 1);
|
||||
let bytes = hex::decode(block_str).expect(&format!("bad block file {idx}"));
|
||||
let bytes = hex::decode(block_str).unwrap_or_else(|_| panic!("bad block file {idx}"));
|
||||
|
||||
let block: BlockWrapper =
|
||||
minicbor::decode(&bytes[..]).expect(&format!("error decoding cbor for file {idx}"));
|
||||
let block: BlockWrapper = minicbor::decode(&bytes[..])
|
||||
.unwrap_or_else(|_| panic!("error decoding cbor for file {idx}"));
|
||||
|
||||
let bytes2 = to_vec(block).expect(&format!("error encoding block cbor for file {idx}"));
|
||||
let bytes2 = to_vec(block)
|
||||
.unwrap_or_else(|_| panic!("error encoding block cbor for file {idx}"));
|
||||
|
||||
assert!(bytes.eq(&bytes2), "re-encoded bytes didn't match original");
|
||||
}
|
||||
|
|
@ -1643,13 +1644,13 @@ mod tests {
|
|||
|
||||
for (idx, header_str) in test_headers.iter().enumerate() {
|
||||
println!("decoding test header {}", idx + 1);
|
||||
let bytes = hex::decode(header_str).expect(&format!("bad header file {idx}"));
|
||||
let bytes = hex::decode(header_str).unwrap_or_else(|_| panic!("bad header file {idx}"));
|
||||
|
||||
let header: Header =
|
||||
minicbor::decode(&bytes[..]).expect(&format!("error decoding cbor for file {idx}"));
|
||||
let header: Header = minicbor::decode(&bytes[..])
|
||||
.unwrap_or_else(|_| panic!("error decoding cbor for file {idx}"));
|
||||
|
||||
let bytes2 =
|
||||
to_vec(header).expect(&format!("error encoding header cbor for file {idx}"));
|
||||
let bytes2 = to_vec(header)
|
||||
.unwrap_or_else(|_| panic!("error encoding header cbor for file {idx}"));
|
||||
|
||||
assert!(bytes.eq(&bytes2), "re-encoded bytes didn't match original");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -764,13 +764,13 @@ mod tests {
|
|||
|
||||
for (idx, block_str) in test_blocks.iter().enumerate() {
|
||||
println!("decoding test block {}", idx + 1);
|
||||
let bytes = hex::decode(block_str).expect(&format!("bad block file {idx}"));
|
||||
let bytes = hex::decode(block_str).unwrap_or_else(|_| panic!("bad block file {idx}"));
|
||||
|
||||
let block: BlockWrapper =
|
||||
minicbor::decode(&bytes[..]).expect(&format!("error decoding cbor for file {idx}"));
|
||||
let block: BlockWrapper = minicbor::decode(&bytes[..])
|
||||
.unwrap_or_else(|_| panic!("error decoding cbor for file {idx}"));
|
||||
|
||||
let bytes2 = minicbor::to_vec(block)
|
||||
.expect(&format!("error encoding block cbor for file {idx}"));
|
||||
.unwrap_or_else(|_| panic!("error encoding block cbor for file {idx}"));
|
||||
|
||||
assert!(bytes.eq(&bytes2), "re-encoded bytes didn't match original");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -833,12 +833,13 @@ mod tests {
|
|||
|
||||
for (idx, block_str) in test_blocks.iter().enumerate() {
|
||||
println!("decoding test block {}", idx + 1);
|
||||
let bytes = hex::decode(block_str).expect(&format!("bad block file {idx}"));
|
||||
let bytes = hex::decode(block_str).unwrap_or_else(|_| panic!("bad block file {idx}"));
|
||||
|
||||
let block: BlockWrapper =
|
||||
minicbor::decode(&bytes[..]).expect(&format!("error decoding cbor for file {idx}"));
|
||||
let block: BlockWrapper = minicbor::decode(&bytes[..])
|
||||
.unwrap_or_else(|_| panic!("error decoding cbor for file {idx}"));
|
||||
|
||||
let bytes2 = to_vec(block).expect(&format!("error encoding block cbor for file {idx}"));
|
||||
let bytes2 = to_vec(block)
|
||||
.unwrap_or_else(|_| panic!("error encoding block cbor for file {idx}"));
|
||||
|
||||
assert_eq!(hex::encode(bytes), hex::encode(bytes2));
|
||||
}
|
||||
|
|
@ -861,12 +862,13 @@ mod tests {
|
|||
|
||||
for (idx, block_str) in test_blocks.iter().enumerate() {
|
||||
println!("decoding test block {}", idx + 1);
|
||||
let bytes = hex::decode(block_str).expect(&format!("bad block file {idx}"));
|
||||
let bytes = hex::decode(block_str).unwrap_or_else(|_| panic!("bad block file {idx}"));
|
||||
|
||||
let block: BlockWrapper =
|
||||
minicbor::decode(&bytes[..]).expect(&format!("error decoding cbor for file {idx}"));
|
||||
let block: BlockWrapper = minicbor::decode(&bytes[..])
|
||||
.unwrap_or_else(|_| panic!("error decoding cbor for file {idx}"));
|
||||
|
||||
let bytes2 = to_vec(block).expect(&format!("error encoding block cbor for file {idx}"));
|
||||
let bytes2 = to_vec(block)
|
||||
.unwrap_or_else(|_| panic!("error encoding block cbor for file {idx}"));
|
||||
|
||||
assert_eq!(hex::encode(bytes), hex::encode(bytes2));
|
||||
}
|
||||
|
|
@ -878,13 +880,13 @@ mod tests {
|
|||
|
||||
for (idx, str) in subjects.iter().enumerate() {
|
||||
println!("decoding test header {}", idx + 1);
|
||||
let bytes = hex::decode(str).expect(&format!("bad header file {idx}"));
|
||||
let bytes = hex::decode(str).unwrap_or_else(|_| panic!("bad header file {idx}"));
|
||||
|
||||
let block: BlockHead = minicbor::decode(&bytes[..])
|
||||
.expect(&format!("error decoding cbor for file {}", idx));
|
||||
.unwrap_or_else(|_| panic!("error decoding cbor for file {idx}"));
|
||||
|
||||
let bytes2 =
|
||||
to_vec(block).expect(&format!("error encoding header cbor for file {idx}"));
|
||||
let bytes2 = to_vec(block)
|
||||
.unwrap_or_else(|_| panic!("error encoding header cbor for file {idx}"));
|
||||
|
||||
assert_eq!(bytes, bytes2);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue