Merge rust-bitcoin/rust-bitcoin#3572: Automated nightly rustfmt (2024-11-03)
5ecf7f2d67
2024-11-03 automated rustfmt nightly (Fmt Bot)
Pull request description:
Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action
ACKs for top commit:
apoelstra:
ACK 5ecf7f2d6795b07f8c4e3f2804e018deca80f113; successfully ran local tests
Tree-SHA512: b66b82b185120cd8f00f5bb986c914011003b727f2c172cb3da720fb2b8ac2d4027e6a9f75673ccda0a1328a77cd1bfff9aaf47506ae40a68e8984b19a250d85
This commit is contained in:
commit
26873c4ee8
|
@ -145,7 +145,7 @@ internals::impl_from_infallible!(InvalidCharacterError);
|
|||
internals::impl_from_infallible!(InvalidCharacterErrorInner);
|
||||
|
||||
impl InvalidCharacterError {
|
||||
pub(super) fn new(invalid: u8) -> Self { Self(InvalidCharacterErrorInner{ invalid }) }
|
||||
pub(super) fn new(invalid: u8) -> Self { Self(InvalidCharacterErrorInner { invalid }) }
|
||||
|
||||
/// Returns the invalid base58 character.
|
||||
pub fn invalid_character(&self) -> u8 { self.0.invalid }
|
||||
|
|
|
@ -74,7 +74,9 @@ pub mod hex {
|
|||
pub struct Encoder<C: Case>(BufEncoder<{ HEX_BUF_SIZE }>, PhantomData<C>);
|
||||
|
||||
impl<C: Case> From<super::Hex<C>> for Encoder<C> {
|
||||
fn from(_: super::Hex<C>) -> Self { Encoder(BufEncoder::new(C::INTERNAL_CASE), Default::default()) }
|
||||
fn from(_: super::Hex<C>) -> Self {
|
||||
Encoder(BufEncoder::new(C::INTERNAL_CASE), Default::default())
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: Case> super::EncodeBytes for Encoder<C> {
|
||||
|
|
|
@ -446,7 +446,6 @@ impl PrivateKey {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// Serializes the private key to bytes.
|
||||
#[deprecated(since = "TBD", note = "use to_vec instead")]
|
||||
pub fn to_bytes(self) -> Vec<u8> { self.to_vec() }
|
||||
|
|
|
@ -327,6 +327,7 @@ fn keystream_at_slice(key: Key, nonce: Nonce, count: u32, seek: usize) -> [u8; 6
|
|||
#[cfg(feature = "alloc")]
|
||||
mod tests {
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use hex::prelude::*;
|
||||
|
||||
use super::*;
|
||||
|
|
|
@ -150,6 +150,7 @@ fn encode_lengths(aad_len: u64, content_len: u64) -> [u8; 16] {
|
|||
#[cfg(feature = "alloc")]
|
||||
mod tests {
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use hex::prelude::*;
|
||||
|
||||
use super::*;
|
||||
|
|
|
@ -224,6 +224,7 @@ fn _print_acc(num: &[u32; 5]) {
|
|||
#[cfg(feature = "alloc")]
|
||||
mod tests {
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use hex::prelude::*;
|
||||
|
||||
use super::*;
|
||||
|
|
|
@ -66,7 +66,7 @@ pub use self::{
|
|||
#[cfg(feature = "alloc")]
|
||||
pub use self::{
|
||||
locktime::{absolute, relative},
|
||||
transaction::{TxIn, TxOut, Transaction},
|
||||
transaction::{Transaction, TxIn, TxOut},
|
||||
witness::Witness,
|
||||
};
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ use core::{cmp, convert, fmt};
|
|||
#[cfg(all(test, mutate))]
|
||||
use mutagen::mutate;
|
||||
|
||||
use crate::Sequence;
|
||||
#[cfg(all(doc, feature = "alloc"))]
|
||||
use crate::{relative, TxIn};
|
||||
use crate::Sequence;
|
||||
|
||||
#[rustfmt::skip] // Keep public re-exports separate.
|
||||
#[doc(inline)]
|
||||
|
|
|
@ -307,7 +307,9 @@ internals::impl_from_infallible!(ParseError);
|
|||
|
||||
impl ParseError {
|
||||
fn invalid_int<S: Into<InputString>>(s: S) -> impl FnOnce(core::num::ParseIntError) -> Self {
|
||||
move |source| Self::ParseInt(ParseIntError { input: s.into(), bits: 32, is_signed: true , source })
|
||||
move |source| {
|
||||
Self::ParseInt(ParseIntError { input: s.into(), bits: 32, is_signed: true, source })
|
||||
}
|
||||
}
|
||||
|
||||
fn display(
|
||||
|
@ -322,13 +324,29 @@ impl ParseError {
|
|||
use ParseError::*;
|
||||
|
||||
match self {
|
||||
ParseInt(ParseIntError { input, bits: _, is_signed: _, source }) if *source.kind() == IntErrorKind::PosOverflow => {
|
||||
ParseInt(ParseIntError { input, bits: _, is_signed: _, source })
|
||||
if *source.kind() == IntErrorKind::PosOverflow =>
|
||||
{
|
||||
// Outputs "failed to parse <input_string> as absolute Height/Time (<subject> is above limit <upper_bound>)"
|
||||
write!(f, "{} ({} is above limit {})", input.display_cannot_parse("absolute Height/Time"), subject, upper_bound)
|
||||
write!(
|
||||
f,
|
||||
"{} ({} is above limit {})",
|
||||
input.display_cannot_parse("absolute Height/Time"),
|
||||
subject,
|
||||
upper_bound
|
||||
)
|
||||
}
|
||||
ParseInt(ParseIntError { input, bits: _, is_signed: _, source }) if *source.kind() == IntErrorKind::NegOverflow => {
|
||||
ParseInt(ParseIntError { input, bits: _, is_signed: _, source })
|
||||
if *source.kind() == IntErrorKind::NegOverflow =>
|
||||
{
|
||||
// Outputs "failed to parse <input_string> as absolute Height/Time (<subject> is below limit <lower_bound>)"
|
||||
write!(f, "{} ({} is below limit {})", input.display_cannot_parse("absolute Height/Time"), subject, lower_bound)
|
||||
write!(
|
||||
f,
|
||||
"{} ({} is below limit {})",
|
||||
input.display_cannot_parse("absolute Height/Time"),
|
||||
subject,
|
||||
lower_bound
|
||||
)
|
||||
}
|
||||
ParseInt(ParseIntError { input, bits: _, is_signed: _, source: _ }) => {
|
||||
write!(f, "{} ({})", input.display_cannot_parse("absolute Height/Time"), subject)
|
||||
|
@ -350,8 +368,12 @@ impl ParseError {
|
|||
use ParseError::*;
|
||||
|
||||
match self {
|
||||
ParseInt(ParseIntError { source, .. }) if *source.kind() == IntErrorKind::PosOverflow => None,
|
||||
ParseInt(ParseIntError { source, .. }) if *source.kind() == IntErrorKind::NegOverflow => None,
|
||||
ParseInt(ParseIntError { source, .. })
|
||||
if *source.kind() == IntErrorKind::PosOverflow =>
|
||||
None,
|
||||
ParseInt(ParseIntError { source, .. })
|
||||
if *source.kind() == IntErrorKind::NegOverflow =>
|
||||
None,
|
||||
ParseInt(ParseIntError { source, .. }) => Some(source),
|
||||
Conversion(_) => None,
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
use core::fmt;
|
||||
use core::str::FromStr;
|
||||
|
||||
use internals::write_err;
|
||||
use internals::error::InputString;
|
||||
use internals::write_err;
|
||||
|
||||
/// Error with rich context returned when a string can't be parsed as an integer.
|
||||
///
|
||||
|
|
Loading…
Reference in New Issue