Merge rust-bitcoin/rust-bitcoin#3180: Automated nightly rustfmt (2024-08-18)
ce3851d241
2024-08-18 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: ACKce3851d241
successfully ran local tests Tree-SHA512: 17dd4b6de21665b0f99f373d4ce911fbc180df880dcbf9aecbcab24578a0a210a5570faeab1f5e5580ebe63d81310cc8af767ec877ecfa0bf22933e63a0d7834
This commit is contained in:
commit
32a42cbfc0
104
io/src/bridge.rs
104
io/src/bridge.rs
|
@ -12,21 +12,15 @@ impl<T> FromStd<T> {
|
|||
|
||||
/// Returns the wrapped value.
|
||||
#[inline]
|
||||
pub fn into_inner(self) -> T {
|
||||
self.0
|
||||
}
|
||||
pub fn into_inner(self) -> T { self.0 }
|
||||
|
||||
/// Returns a reference to the wrapped value.
|
||||
#[inline]
|
||||
pub fn inner(&self) -> &T {
|
||||
&self.0
|
||||
}
|
||||
pub fn inner(&self) -> &T { &self.0 }
|
||||
|
||||
/// Returns a mutable reference to the wrapped value.
|
||||
#[inline]
|
||||
pub fn inner_mut(&mut self) -> &mut T {
|
||||
&mut self.0
|
||||
}
|
||||
pub fn inner_mut(&mut self) -> &mut T { &mut self.0 }
|
||||
|
||||
/// Wraps a mutable reference to IO type.
|
||||
#[inline]
|
||||
|
@ -58,14 +52,10 @@ impl<T: std::io::Read> super::Read for FromStd<T> {
|
|||
|
||||
impl<T: std::io::BufRead> super::BufRead for FromStd<T> {
|
||||
#[inline]
|
||||
fn fill_buf(&mut self) -> super::Result<&[u8]> {
|
||||
self.0.fill_buf().map_err(Into::into)
|
||||
}
|
||||
fn fill_buf(&mut self) -> super::Result<&[u8]> { self.0.fill_buf().map_err(Into::into) }
|
||||
|
||||
#[inline]
|
||||
fn consume(&mut self, amount: usize) {
|
||||
self.0.consume(amount)
|
||||
}
|
||||
fn consume(&mut self, amount: usize) { self.0.consume(amount) }
|
||||
}
|
||||
|
||||
impl<T: std::io::Write> super::Write for FromStd<T> {
|
||||
|
@ -75,9 +65,7 @@ impl<T: std::io::Write> super::Write for FromStd<T> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn flush(&mut self) -> super::Result<()> {
|
||||
self.0.flush().map_err(Into::into)
|
||||
}
|
||||
fn flush(&mut self) -> super::Result<()> { self.0.flush().map_err(Into::into) }
|
||||
|
||||
#[inline]
|
||||
fn write_all(&mut self, buf: &[u8]) -> super::Result<()> {
|
||||
|
@ -89,43 +77,29 @@ impl<T: std::io::Write> super::Write for FromStd<T> {
|
|||
|
||||
impl<T: std::io::Read> std::io::Read for FromStd<T> {
|
||||
#[inline]
|
||||
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
self.0.read(buf)
|
||||
}
|
||||
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> { self.0.read(buf) }
|
||||
|
||||
#[inline]
|
||||
fn read_exact(&mut self, buf: &mut [u8]) -> std::io::Result<()> {
|
||||
self.0.read_exact(buf)
|
||||
}
|
||||
fn read_exact(&mut self, buf: &mut [u8]) -> std::io::Result<()> { self.0.read_exact(buf) }
|
||||
}
|
||||
|
||||
impl<T: std::io::BufRead> std::io::BufRead for FromStd<T> {
|
||||
#[inline]
|
||||
fn fill_buf(&mut self) -> std::io::Result<&[u8]> {
|
||||
self.0.fill_buf()
|
||||
}
|
||||
fn fill_buf(&mut self) -> std::io::Result<&[u8]> { self.0.fill_buf() }
|
||||
|
||||
#[inline]
|
||||
fn consume(&mut self, amount: usize) {
|
||||
self.0.consume(amount)
|
||||
}
|
||||
fn consume(&mut self, amount: usize) { self.0.consume(amount) }
|
||||
}
|
||||
|
||||
impl<T: std::io::Write> std::io::Write for FromStd<T> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
self.0.write(buf)
|
||||
}
|
||||
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> { self.0.write(buf) }
|
||||
|
||||
#[inline]
|
||||
fn flush(&mut self) -> std::io::Result<()> {
|
||||
self.0.flush()
|
||||
}
|
||||
fn flush(&mut self) -> std::io::Result<()> { self.0.flush() }
|
||||
|
||||
#[inline]
|
||||
fn write_all(&mut self, buf: &[u8]) -> std::io::Result<()> {
|
||||
self.0.write_all(buf)
|
||||
}
|
||||
fn write_all(&mut self, buf: &[u8]) -> std::io::Result<()> { self.0.write_all(buf) }
|
||||
}
|
||||
|
||||
/// A bridging wrapper providing the std traits for types that already implement our traits.
|
||||
|
@ -139,21 +113,15 @@ impl<T> ToStd<T> {
|
|||
|
||||
/// Returns the wrapped value.
|
||||
#[inline]
|
||||
pub fn into_inner(self) -> T {
|
||||
self.0
|
||||
}
|
||||
pub fn into_inner(self) -> T { self.0 }
|
||||
|
||||
/// Returns a reference to the wrapped value.
|
||||
#[inline]
|
||||
pub fn inner(&self) -> &T {
|
||||
&self.0
|
||||
}
|
||||
pub fn inner(&self) -> &T { &self.0 }
|
||||
|
||||
/// Returns a mutable reference to the wrapped value.
|
||||
#[inline]
|
||||
pub fn inner_mut(&mut self) -> &mut T {
|
||||
&mut self.0
|
||||
}
|
||||
pub fn inner_mut(&mut self) -> &mut T { &mut self.0 }
|
||||
|
||||
/// Wraps a mutable reference to IO type.
|
||||
#[inline]
|
||||
|
@ -185,14 +153,10 @@ impl<T: super::Read> std::io::Read for ToStd<T> {
|
|||
|
||||
impl<T: super::BufRead> std::io::BufRead for ToStd<T> {
|
||||
#[inline]
|
||||
fn fill_buf(&mut self) -> std::io::Result<&[u8]> {
|
||||
self.0.fill_buf().map_err(Into::into)
|
||||
}
|
||||
fn fill_buf(&mut self) -> std::io::Result<&[u8]> { self.0.fill_buf().map_err(Into::into) }
|
||||
|
||||
#[inline]
|
||||
fn consume(&mut self, amount: usize) {
|
||||
self.0.consume(amount)
|
||||
}
|
||||
fn consume(&mut self, amount: usize) { self.0.consume(amount) }
|
||||
}
|
||||
|
||||
impl<T: super::Write> std::io::Write for ToStd<T> {
|
||||
|
@ -202,9 +166,7 @@ impl<T: super::Write> std::io::Write for ToStd<T> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn flush(&mut self) -> std::io::Result<()> {
|
||||
self.0.flush().map_err(Into::into)
|
||||
}
|
||||
fn flush(&mut self) -> std::io::Result<()> { self.0.flush().map_err(Into::into) }
|
||||
|
||||
#[inline]
|
||||
fn write_all(&mut self, buf: &[u8]) -> std::io::Result<()> {
|
||||
|
@ -216,43 +178,29 @@ impl<T: super::Write> std::io::Write for ToStd<T> {
|
|||
|
||||
impl<T: super::Read> super::Read for ToStd<T> {
|
||||
#[inline]
|
||||
fn read(&mut self, buf: &mut [u8]) -> super::Result<usize> {
|
||||
self.0.read(buf)
|
||||
}
|
||||
fn read(&mut self, buf: &mut [u8]) -> super::Result<usize> { self.0.read(buf) }
|
||||
|
||||
#[inline]
|
||||
fn read_exact(&mut self, buf: &mut [u8]) -> super::Result<()> {
|
||||
self.0.read_exact(buf)
|
||||
}
|
||||
fn read_exact(&mut self, buf: &mut [u8]) -> super::Result<()> { self.0.read_exact(buf) }
|
||||
}
|
||||
|
||||
impl<T: super::BufRead> super::BufRead for ToStd<T> {
|
||||
#[inline]
|
||||
fn fill_buf(&mut self) -> super::Result<&[u8]> {
|
||||
self.0.fill_buf()
|
||||
}
|
||||
fn fill_buf(&mut self) -> super::Result<&[u8]> { self.0.fill_buf() }
|
||||
|
||||
#[inline]
|
||||
fn consume(&mut self, amount: usize) {
|
||||
self.0.consume(amount)
|
||||
}
|
||||
fn consume(&mut self, amount: usize) { self.0.consume(amount) }
|
||||
}
|
||||
|
||||
impl<T: super::Write> super::Write for ToStd<T> {
|
||||
#[inline]
|
||||
fn write(&mut self, buf: &[u8]) -> super::Result<usize> {
|
||||
self.0.write(buf)
|
||||
}
|
||||
fn write(&mut self, buf: &[u8]) -> super::Result<usize> { self.0.write(buf) }
|
||||
|
||||
#[inline]
|
||||
fn flush(&mut self) -> super::Result<()> {
|
||||
self.0.flush()
|
||||
}
|
||||
fn flush(&mut self) -> super::Result<()> { self.0.flush() }
|
||||
|
||||
#[inline]
|
||||
fn write_all(&mut self, buf: &[u8]) -> super::Result<()> {
|
||||
self.0.write_all(buf)
|
||||
}
|
||||
fn write_all(&mut self, buf: &[u8]) -> super::Result<()> { self.0.write_all(buf) }
|
||||
}
|
||||
|
||||
macro_rules! impl_our {
|
||||
|
|
|
@ -21,18 +21,18 @@
|
|||
#[cfg(feature = "alloc")]
|
||||
extern crate alloc;
|
||||
|
||||
mod error;
|
||||
mod macros;
|
||||
#[cfg(feature = "std")]
|
||||
mod bridge;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub use bridge::{FromStd, ToStd};
|
||||
mod error;
|
||||
mod macros;
|
||||
|
||||
#[cfg(all(not(feature = "std"), feature = "alloc"))]
|
||||
use alloc::vec::Vec;
|
||||
use core::cmp;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub use bridge::{FromStd, ToStd};
|
||||
|
||||
#[rustfmt::skip] // Keep public re-exports separate.
|
||||
pub use self::error::{Error, ErrorKind};
|
||||
|
||||
|
@ -194,9 +194,7 @@ impl<T: AsRef<[u8]>> Cursor<T> {
|
|||
/// Note that setting a position that is larger than the buffer length will cause reads to
|
||||
/// return no bytes (EOF).
|
||||
#[inline]
|
||||
pub fn set_position(&mut self, position: u64) {
|
||||
self.pos = position;
|
||||
}
|
||||
pub fn set_position(&mut self, position: u64) { self.pos = position; }
|
||||
|
||||
/// Returns the inner buffer.
|
||||
///
|
||||
|
@ -311,18 +309,14 @@ pub fn sink() -> Sink { Sink }
|
|||
/// All methods are passed through converting the errors.
|
||||
#[cfg(feature = "std")]
|
||||
#[inline]
|
||||
pub const fn from_std<T>(std_io: T) -> FromStd<T> {
|
||||
FromStd::new(std_io)
|
||||
}
|
||||
pub const fn from_std<T>(std_io: T) -> FromStd<T> { FromStd::new(std_io) }
|
||||
|
||||
/// Wraps a mutable reference to `std` IO type to implement the traits from this crate.
|
||||
///
|
||||
/// All methods are passed through converting the errors.
|
||||
#[cfg(feature = "std")]
|
||||
#[inline]
|
||||
pub fn from_std_mut<T>(std_io: &mut T) -> &mut FromStd<T> {
|
||||
FromStd::new_mut(std_io)
|
||||
}
|
||||
pub fn from_std_mut<T>(std_io: &mut T) -> &mut FromStd<T> { FromStd::new_mut(std_io) }
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
|
|
@ -41,10 +41,7 @@ pub use units::*;
|
|||
#[cfg(feature = "alloc")]
|
||||
pub use self::locktime::{absolute, relative};
|
||||
#[doc(inline)]
|
||||
pub use self::{
|
||||
pow::CompactTarget,
|
||||
sequence::Sequence,
|
||||
};
|
||||
pub use self::{pow::CompactTarget, sequence::Sequence};
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[allow(unused_imports)]
|
||||
|
|
Loading…
Reference in New Issue