Use Result::expect() in test (de)serializations

This commit is contained in:
Deirdre Connolly 2020-02-03 19:29:00 -05:00 committed by Deirdre Connolly
parent 9b6a9d8e86
commit 9257d838bd
1 changed files with 5 additions and 4 deletions

View File

@ -86,12 +86,13 @@ fn blockheaderhash_from_blockheader() {
let mut bytes = Cursor::new(Vec::new());
// rustc keeps telling me I can't use `?` here, but unwrap() works fine???
blockheader.zcash_serialize(&mut bytes).unwrap();
blockheader
.zcash_serialize(&mut bytes)
.expect("these bytes to serialize from a blockheader without issue");
bytes.set_position(0);
// rustc keeps telling me I can't use `?` here, but unwrap() works fine???
let other_header = BlockHeader::zcash_deserialize(&mut bytes).unwrap();
let other_header = BlockHeader::zcash_deserialize(&mut bytes)
.expect("these bytes to deserialize into a blockheader without issue");
assert_eq!(blockheader, other_header);
}