Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
LLFourn committed Sep 15, 2020
1 parent 73b2fe9 commit dbaa0e6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
7 changes: 2 additions & 5 deletions secp256kfun/src/hex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::string::String;
#[cfg(feature = "std")]
use std::vec::Vec;


use core::fmt;
/// Error representing a failed conversion from hex into the bytes for the target type.
#[derive(Debug, Clone, PartialEq)]
Expand All @@ -22,14 +21,13 @@ pub enum HexError {
InvalidEncoding,
}


impl fmt::Display for HexError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use HexError::*;
match self {
InvalidHex => write!(f, "invalid hex string"),
InvalidLength => write!(f, "hex string had an invalid (odd) length"),
InvalidEncoding => write!(f, "hex value did not encode the expected type")
InvalidEncoding => write!(f, "hex value did not encode the expected type"),
}
}
}
Expand All @@ -47,7 +45,6 @@ pub fn hex_val(c: u8) -> Result<u8, HexError> {
}
}


#[cfg(feature = "alloc")]
/// Encode some bytes as a hex String.
///
Expand Down Expand Up @@ -75,7 +72,7 @@ pub fn encode(bytes: &[u8]) -> String {
#[cfg(feature = "alloc")]
pub fn decode(hex: &str) -> Result<Vec<u8>, HexError> {
if (hex.len() % 2) != 0 {
return Err(HexError::InvalidLength)
return Err(HexError::InvalidLength);
}
let mut bytes = Vec::with_capacity(hex.len() * 2);

Expand Down
4 changes: 1 addition & 3 deletions secp256kfun/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ extern crate alloc;
extern crate std;

pub mod hash;
pub mod nonce;
pub mod hex;
pub mod nonce;

pub use digest;
pub use rand_core;
Expand Down Expand Up @@ -56,7 +56,5 @@ mod libsecp_compat;
pub static G: &'static Point<marker::BasePoint, marker::Public, marker::NonZero> =
&Point::from_inner(backend::G_JACOBIAN, marker::BasePoint(backend::G_TABLE));



#[doc(hidden)]
pub const TEST_SOUNDNESS: usize = 20;
2 changes: 1 addition & 1 deletion secp256kfun/tests/serialization_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
mod test {

use core::{marker::PhantomData, str::FromStr};
use secp256kfun::{impl_display_debug_serialize, impl_fromstr_deserailize, hex::HexError};
use secp256kfun::{hex::HexError, impl_display_debug_serialize, impl_fromstr_deserailize};

#[derive(PartialEq)]
struct SixBytes<T>([u8; 6], PhantomData<T>);
Expand Down

0 comments on commit dbaa0e6

Please sign in to comment.