Skip to content

Commit

Permalink
Use empty struct for Zero.
Browse files Browse the repository at this point in the history
Empty typle structs are not stable yet. This change makes proteus
compatible with rustc stable again.
  • Loading branch information
twittner committed Feb 1, 2017
1 parent fe9b818 commit 504372a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/internal/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ impl KeyPair {
// SecretKey ////////////////////////////////////////////////////////////////

#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct Zero();
pub struct Zero {}

#[derive(Clone)]
pub struct SecretKey {
Expand All @@ -391,7 +391,7 @@ impl SecretKey {
pub fn shared_secret(&self, p: &PublicKey) -> Result<[u8; 32], Zero> {
ecdh::scalarmult(&self.sec_curve, &p.pub_curve)
.map(|ge| ge.0)
.map_err(|()| Zero())
.map_err(|()| Zero {})
}

pub fn encode<W: Write>(&self, e: &mut Encoder<W>) -> EncodeResult<()> {
Expand Down Expand Up @@ -613,6 +613,6 @@ mod tests {
for i in 0 .. k.public_key.pub_curve.0.len() {
k.public_key.pub_curve.0[i] = 0
}
assert_eq!(Err(Zero()), k.secret_key.shared_secret(&k.public_key))
assert_eq!(Err(Zero {}), k.secret_key.shared_secret(&k.public_key))
}
}

0 comments on commit 504372a

Please sign in to comment.