Skip to content

Commit

Permalink
Fixed some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Koenders committed Mar 17, 2024
1 parent 735e175 commit e44d7c1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/features/impl_alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ where
if unty::type_equal::<T, u8>() {
decoder.claim_container_read::<T>(len)?;
// optimize for reading u8 vecs
let mut vec = alloc::vec![0u8; len];
let mut vec = alloc::vec::from_elem(0u8, len);
decoder.reader().read(&mut vec)?;
// Safety: Vec<T> is Vec<u8>
Ok(unsafe { core::mem::transmute(vec) })
Expand Down Expand Up @@ -630,13 +630,15 @@ where
}
}

#[cfg(not(feature = "unstable-strict-oom-checks"))]
/// A drop guard that will trigger when an item fails to decode.
/// If an item at index n fails to decode, we have to properly drop the 0..(n-1) values that have been read.
struct DropGuard<'a, T> {

Check warning on line 636 in src/features/impl_alloc.rs

View workflow job for this annotation

GitHub Actions / Check (nightly)

struct `DropGuard` is never constructed

Check warning on line 636 in src/features/impl_alloc.rs

View workflow job for this annotation

GitHub Actions / Check (nightly)

struct `DropGuard` is never constructed
slice: &'a mut [core::mem::MaybeUninit<T>],
idx: usize,
}

#[cfg(not(feature = "unstable-strict-oom-checks"))]
impl<'a, T> Drop for DropGuard<'a, T> {
fn drop(&mut self) {
unsafe {
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ pub mod de;
pub mod enc;
pub mod error;

pub use atomic::*;
pub use de::{BorrowDecode, Decode};
pub use enc::Encode;

Expand Down
3 changes: 1 addition & 2 deletions src/varint/decode_unsigned.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use core::{convert::TryInto, u32};

use super::{SINGLE_BYTE_MAX, U128_BYTE, U16_BYTE, U32_BYTE, U64_BYTE};
use crate::{
config::Endianness,
de::read::Reader,
error::{DecodeError, IntegerType},
};
use core::u32;

#[inline(never)]
#[cold]
Expand Down

0 comments on commit e44d7c1

Please sign in to comment.