summaryrefslogtreecommitdiff
path: root/src/utils.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.rs')
-rw-r--r--src/utils.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/utils.rs b/src/utils.rs
index 128493d..c7913f1 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -9,11 +9,8 @@ use serde_json::{Deserializer, Error as JsonError};
/// Read from a raw file descriptor to the vector.
///
/// Appends data at the end of the buffer. Resizes vector as needed.
-#[allow(clippy::needless_pass_by_ref_mut)]
-pub fn read_to_vec(fd: &mut impl AsFd, buf: &mut Vec<u8>) -> io::Result<usize> {
- if buf.capacity() - buf.len() < 1024 {
- buf.reserve(buf.capacity().max(1024));
- }
+pub fn read_to_vec(fd: impl AsFd, buf: &mut Vec<u8>) -> io::Result<usize> {
+ buf.reserve(1024);
let res = unsafe {
libc::read(