Run cargo fmt

We have formatting issues on master because we do not yet run the
formatter in CI (PR is open).

We are about to move the `address` module to `/src` which will require
running the formatter.

Run `cargo fmt` to fix formatting issues, no other changes.
This commit is contained in:
Tobin C. Harding 2022-08-02 16:00:11 +10:00
parent 0eff9eb94a
commit 6cc8b22f82
4 changed files with 17 additions and 23 deletions

View File

@ -16,9 +16,7 @@ macro_rules! impl_std_error {
#[cfg(feature = "std")] #[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))] #[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl std::error::Error for $type { impl std::error::Error for $type {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { Some(&self.$field) }
Some(&self.$field)
}
} }
}; };
} }

View File

@ -61,24 +61,21 @@ extern crate test;
extern crate alloc; extern crate alloc;
// Re-export dependencies we control. // Re-export dependencies we control.
pub use bitcoin_hashes as hashes;
pub use secp256k1;
pub use bech32;
#[cfg(feature = "bitcoinconsensus")] #[cfg(feature = "bitcoinconsensus")]
pub use bitcoinconsensus; pub use bitcoinconsensus;
pub use {bech32, bitcoin_hashes as hashes, secp256k1};
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
#[macro_use] #[macro_use]
extern crate actual_serde as serde; extern crate actual_serde as serde;
#[cfg(test)] #[cfg(test)]
#[macro_use] #[macro_use]
mod test_macros; mod test_macros;
mod internal_macros; mod internal_macros;
mod parse;
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
mod serde_utils; mod serde_utils;
mod parse;
#[macro_use] #[macro_use]
pub mod network; pub mod network;

View File

@ -1,8 +1,9 @@
use crate::internal_macros::write_err; use core::convert::TryFrom;
use crate::error::impl_std_error;
use core::fmt; use core::fmt;
use core::str::FromStr; use core::str::FromStr;
use core::convert::TryFrom;
use crate::error::impl_std_error;
use crate::internal_macros::write_err;
use crate::prelude::*; use crate::prelude::*;
/// Error with rich context returned when a string can't be parsed as an integer. /// Error with rich context returned when a string can't be parsed as an integer.
@ -28,21 +29,15 @@ pub struct ParseIntError {
impl ParseIntError { impl ParseIntError {
/// Returns the input that was attempted to be parsed. /// Returns the input that was attempted to be parsed.
pub fn input(&self) -> &str { pub fn input(&self) -> &str { &self.input }
&self.input
}
} }
impl From<ParseIntError> for core::num::ParseIntError { impl From<ParseIntError> for core::num::ParseIntError {
fn from(value: ParseIntError) -> Self { fn from(value: ParseIntError) -> Self { value.source }
value.source
}
} }
impl AsRef<core::num::ParseIntError> for ParseIntError { impl AsRef<core::num::ParseIntError> for ParseIntError {
fn as_ref(&self) -> &core::num::ParseIntError { fn as_ref(&self) -> &core::num::ParseIntError { &self.source }
&self.source
}
} }
impl fmt::Display for ParseIntError { impl fmt::Display for ParseIntError {
@ -55,7 +50,10 @@ impl fmt::Display for ParseIntError {
/// Not strictly neccessary but serves as a lint - avoids weird behavior if someone accidentally /// Not strictly neccessary but serves as a lint - avoids weird behavior if someone accidentally
/// passes non-integer to the `parse()` function. /// passes non-integer to the `parse()` function.
pub(crate) trait Integer: FromStr<Err=core::num::ParseIntError> + TryFrom<i8> + Sized {} pub(crate) trait Integer:
FromStr<Err = core::num::ParseIntError> + TryFrom<i8> + Sized
{
}
macro_rules! impl_integer { macro_rules! impl_integer {
($($type:ty),* $(,)?) => { ($($type:ty),* $(,)?) => {

View File

@ -235,9 +235,10 @@ pub mod hex_bytes {
//! Module for serialization of byte arrays as hex strings. //! Module for serialization of byte arrays as hex strings.
#![allow(missing_docs)] #![allow(missing_docs)]
use crate::hashes::hex::{FromHex, ToHex};
use serde; use serde;
use crate::hashes::hex::{FromHex, ToHex};
pub fn serialize<T, S>(bytes: &T, s: S) -> Result<S::Ok, S::Error> pub fn serialize<T, S>(bytes: &T, s: S) -> Result<S::Ok, S::Error>
where where
T: serde::Serialize + AsRef<[u8]>, T: serde::Serialize + AsRef<[u8]>,