mirror of
https://github.com/azalea-rs/simdnbt.git
synced 2025-08-02 07:26:04 +00:00
clippy
This commit is contained in:
parent
75fa78057c
commit
bbfce91c97
4 changed files with 17 additions and 17 deletions
|
@ -162,7 +162,7 @@ pub(crate) struct Tapes<'a> {
|
|||
main: MainTape,
|
||||
extra: ExtraTapes<'a>,
|
||||
}
|
||||
impl<'a> Tapes<'a> {
|
||||
impl Tapes<'_> {
|
||||
fn new() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ impl<'a> BaseNbt<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Debug for BaseNbt<'a> {
|
||||
impl Debug for BaseNbt<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("BaseNbt").finish()
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ impl<'a> BaseNbtTag<'a> {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl<'a, 'tape> From<&'a BaseNbtTag<'a>> for NbtTag<'a, 'tape> {
|
||||
impl<'a> From<&'a BaseNbtTag<'a>> for NbtTag<'a, '_> {
|
||||
fn from(tag: &'a BaseNbtTag<'a>) -> Self {
|
||||
tag.as_tag()
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ impl PartialEq for BaseNbt<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> BaseNbt<'a> {
|
||||
impl BaseNbt<'_> {
|
||||
pub fn write(&self, data: &mut Vec<u8>) {
|
||||
data.push(COMPOUND_ID);
|
||||
write_string(data, self.name);
|
||||
|
|
|
@ -71,7 +71,7 @@ impl TapeElement {
|
|||
|
||||
pub fn new_with_approx_len_and_offset(kind: TapeTagKind, approx_len: u32, offset: u32) -> Self {
|
||||
debug_assert!(approx_len < 2u32.pow(24));
|
||||
Self((kind as u64) << 56 | (approx_len as u64) << 32 | (offset as u64))
|
||||
Self(((kind as u64) << 56) | ((approx_len as u64) << 32) | (offset as u64))
|
||||
}
|
||||
pub fn set_offset(&mut self, offset: u32) {
|
||||
*self = Self::new_with_approx_len_and_offset(
|
||||
|
@ -82,16 +82,16 @@ impl TapeElement {
|
|||
}
|
||||
|
||||
pub fn new_with_u8(kind: TapeTagKind, u8: u8) -> Self {
|
||||
Self((kind as u64) << 56 | u8 as u64)
|
||||
Self(((kind as u64) << 56) | u8 as u64)
|
||||
}
|
||||
pub fn new_with_u16(kind: TapeTagKind, u16: u16) -> Self {
|
||||
Self((kind as u64) << 56 | u16 as u64)
|
||||
Self(((kind as u64) << 56) | u16 as u64)
|
||||
}
|
||||
pub fn new_with_u32(kind: TapeTagKind, u32: u32) -> Self {
|
||||
Self((kind as u64) << 56 | u32 as u64)
|
||||
Self(((kind as u64) << 56) | u32 as u64)
|
||||
}
|
||||
pub fn new_with_ptr<T>(kind: TapeTagKind, ptr: *const T) -> Self {
|
||||
Self((kind as u64) << 56 | ptr as u64)
|
||||
Self(((kind as u64) << 56) | ptr as u64)
|
||||
}
|
||||
/// Create a new TapeElement with the given kind and everything else set to 0.
|
||||
pub fn new_with_0(kind: TapeTagKind) -> Self {
|
||||
|
@ -125,7 +125,7 @@ impl Debug for TapeElement {
|
|||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub struct u56 {
|
||||
a: u8,
|
||||
|
@ -152,7 +152,7 @@ impl From<u56> for u64 {
|
|||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub struct u24 {
|
||||
a: u8,
|
||||
|
@ -176,7 +176,7 @@ impl From<u24> for u32 {
|
|||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
pub struct UnalignedU64(pub u64);
|
||||
impl From<u64> for UnalignedU64 {
|
||||
#[inline]
|
||||
|
@ -192,7 +192,7 @@ impl From<UnalignedU64> for u64 {
|
|||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
pub struct UnalignedU32(pub u32);
|
||||
impl From<u32> for UnalignedU32 {
|
||||
#[inline]
|
||||
|
@ -208,7 +208,7 @@ impl From<UnalignedU32> for u32 {
|
|||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[repr(packed)]
|
||||
#[repr(C, packed)]
|
||||
pub struct UnalignedU16(pub u16);
|
||||
impl From<u16> for UnalignedU16 {
|
||||
#[inline]
|
||||
|
|
|
@ -38,12 +38,12 @@ mod tests {
|
|||
}
|
||||
|
||||
fn test_decodes_equally(src: &[u8]) {
|
||||
let nbt_borrow = crate::borrow::read(&mut Cursor::new(&src))
|
||||
let nbt_borrow = crate::borrow::read(&mut Cursor::new(src))
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.as_compound()
|
||||
.to_owned();
|
||||
let nbt_owned = crate::owned::read(&mut Cursor::new(&src))
|
||||
let nbt_owned = crate::owned::read(&mut Cursor::new(src))
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.as_compound();
|
||||
|
|
|
@ -150,7 +150,7 @@ impl<'a> Deref for ReaderFromCursor<'a, '_> {
|
|||
&self.reader
|
||||
}
|
||||
}
|
||||
impl<'a> DerefMut for ReaderFromCursor<'a, '_> {
|
||||
impl DerefMut for ReaderFromCursor<'_, '_> {
|
||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||
&mut self.reader
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue