Skip to content

Commit

Permalink
Use unwrap_err instead of match in test
Browse files Browse the repository at this point in the history
  • Loading branch information
5225225 committed Jan 8, 2022
1 parent 1f5aa1a commit bf13f2f
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions tests/basic_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,13 @@ fn test_duration_out_of_range() {
let result: Result<(std::time::Duration, usize), _> =
bincode::decode_from_slice(&mut input, Configuration::standard());

match result {
Ok(d) => panic!("did not expect to deserialize {:?}", d),
Err(e) => assert_eq!(
e,
bincode::error::DecodeError::InvalidDuration {
secs: u64::MAX,
nanos: u32::MAX
}
),
}
assert_eq!(
result.unwrap_err(),
bincode::error::DecodeError::InvalidDuration {
secs: u64::MAX,
nanos: u32::MAX
}
);
}

#[test]
Expand Down

0 comments on commit bf13f2f

Please sign in to comment.