Skip to content

Commit

Permalink
Simplify comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
expede committed Mar 27, 2024
1 parent 435358b commit 3e8826b
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/crypto/nonce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,8 @@ impl PartialEq for Nonce {
match (self, other) {
(Nonce::Nonce16(a), Nonce::Nonce16(b)) => a == b,
(Nonce::Custom(a), Nonce::Custom(b)) => a == b,
(Nonce::Custom(a), Nonce::Nonce16(b)) => {
if a.len() == 16 {
a.as_slice() == b
} else {
false
}
}
(Nonce::Nonce16(a), Nonce::Custom(b)) => {
if b.len() == 16 {
a == b.as_slice()
} else {
false
}
}
(Nonce::Custom(a), Nonce::Nonce16(b)) => a.as_slice() == b,
(Nonce::Nonce16(a), Nonce::Custom(b)) => a == b.as_slice(),
_ => false,
}
}
Expand Down

0 comments on commit 3e8826b

Please sign in to comment.