mirror of
https://codeberg.org/icewind/bitbuffer.git
synced 2026-06-03 08:34:07 +02:00
fixup: fmt and clippy
This commit is contained in:
parent
2e2e532129
commit
8a5e7e7df8
4 changed files with 13 additions and 12 deletions
|
|
@ -88,6 +88,7 @@ pub use write::{BitWrite, BitWriteSized};
|
||||||
pub use writestream::BitWriteStream;
|
pub use writestream::BitWriteStream;
|
||||||
|
|
||||||
mod endianness;
|
mod endianness;
|
||||||
|
#[allow(missing_docs)]
|
||||||
pub mod num_traits;
|
pub mod num_traits;
|
||||||
mod read;
|
mod read;
|
||||||
mod readbuffer;
|
mod readbuffer;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ pub(crate) enum Data<'a> {
|
||||||
impl<'a> Data<'a> {
|
impl<'a> Data<'a> {
|
||||||
pub fn as_slice(&self) -> &[u8] {
|
pub fn as_slice(&self) -> &[u8] {
|
||||||
match self {
|
match self {
|
||||||
Data::Borrowed(bytes) => *bytes,
|
Data::Borrowed(bytes) => bytes,
|
||||||
Data::Owned(bytes) => bytes.borrow(),
|
Data::Owned(bytes) => bytes.borrow(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -71,7 +71,7 @@ impl<'a> Index<usize> for Data<'a> {
|
||||||
impl<'a> Clone for Data<'a> {
|
impl<'a> Clone for Data<'a> {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
match self {
|
match self {
|
||||||
Data::Borrowed(bytes) => Data::Borrowed(*bytes),
|
Data::Borrowed(bytes) => Data::Borrowed(bytes),
|
||||||
Data::Owned(bytes) => Data::Owned(Rc::clone(bytes)),
|
Data::Owned(bytes) => Data::Owned(Rc::clone(bytes)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -209,7 +209,7 @@ impl<'a, T: BitWrite<E> + ToOwned + ?Sized, E: Endianness> BitWrite<E> for Cow<'
|
||||||
|
|
||||||
macro_rules! impl_write_tuple {
|
macro_rules! impl_write_tuple {
|
||||||
($($i:tt: $type:ident),*) => {
|
($($i:tt: $type:ident),*) => {
|
||||||
impl<'a, E: Endianness, $($type: BitWrite<E>),*> BitWrite<E> for ($($type),*) {
|
impl<E: Endianness, $($type: BitWrite<E>),*> BitWrite<E> for ($($type),*) {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn write(&self, stream: &mut BitWriteStream<E>) -> Result<()> {
|
fn write(&self, stream: &mut BitWriteStream<E>) -> Result<()> {
|
||||||
$(self.$i.write(stream)?;)*
|
$(self.$i.write(stream)?;)*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue