mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-04 06:13:07 +00:00
io: clippy fixes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
eac7ebfc55
commit
36e064d73a
@ -296,7 +296,7 @@ impl<R: io::Read> ReadExt for R {
|
|||||||
fn read_exact_or_eof(&mut self, mut buf: &mut [u8]) -> io::Result<bool> {
|
fn read_exact_or_eof(&mut self, mut buf: &mut [u8]) -> io::Result<bool> {
|
||||||
let mut read_bytes = 0;
|
let mut read_bytes = 0;
|
||||||
loop {
|
loop {
|
||||||
match self.read(&mut buf) {
|
match self.read(buf) {
|
||||||
Ok(0) => {
|
Ok(0) => {
|
||||||
if read_bytes == 0 {
|
if read_bytes == 0 {
|
||||||
return Ok(false);
|
return Ok(false);
|
||||||
|
@ -52,9 +52,8 @@ pub use byte_vec::ByteVecExt;
|
|||||||
/// marked as unsafe for good measure.
|
/// marked as unsafe for good measure.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub unsafe fn uninitialized(len: usize) -> Vec<u8> {
|
pub unsafe fn uninitialized(len: usize) -> Vec<u8> {
|
||||||
let mut out = Vec::with_capacity(len);
|
let data = std::alloc::alloc(std::alloc::Layout::array::<u8>(len).unwrap());
|
||||||
out.set_len(len);
|
Vec::from_raw_parts(data as *mut u8, len, len)
|
||||||
out
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Shortcut to zero out a slice of bytes.
|
/// Shortcut to zero out a slice of bytes.
|
||||||
|
Loading…
Reference in New Issue
Block a user