mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-02 23:21:11 +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> {
|
||||
let mut read_bytes = 0;
|
||||
loop {
|
||||
match self.read(&mut buf) {
|
||||
match self.read(buf) {
|
||||
Ok(0) => {
|
||||
if read_bytes == 0 {
|
||||
return Ok(false);
|
||||
|
@ -52,9 +52,8 @@ pub use byte_vec::ByteVecExt;
|
||||
/// marked as unsafe for good measure.
|
||||
#[inline]
|
||||
pub unsafe fn uninitialized(len: usize) -> Vec<u8> {
|
||||
let mut out = Vec::with_capacity(len);
|
||||
out.set_len(len);
|
||||
out
|
||||
let data = std::alloc::alloc(std::alloc::Layout::array::<u8>(len).unwrap());
|
||||
Vec::from_raw_parts(data as *mut u8, len, len)
|
||||
}
|
||||
|
||||
/// Shortcut to zero out a slice of bytes.
|
||||
|
Loading…
Reference in New Issue
Block a user