This is an automated email from the ASF dual-hosted git repository. xuanwo pushed a commit to branch lazy-reader in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
commit b8fb852d4c570568d6c89c76c94a85a18f241a3b Author: Xuanwo <[email protected]> AuthorDate: Thu Oct 26 21:23:08 2023 +0800 make rustc happy Signed-off-by: Xuanwo <[email protected]> --- core/src/raw/oio/read/api.rs | 8 ++++++++ core/src/raw/rps.rs | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/src/raw/oio/read/api.rs b/core/src/raw/oio/read/api.rs index 436c8447f..579a4858d 100644 --- a/core/src/raw/oio/read/api.rs +++ b/core/src/raw/oio/read/api.rs @@ -292,6 +292,10 @@ where loop { if g.buf.capacity() - g.buf.len() < g.next { g.buf.reserve(g.next); + // # Safety + // + // We make sure that the length of buf is maintained correctly. + #[deny(clippy::uninit_vec)] unsafe { g.buf.set_len(g.buf.capacity()); } @@ -377,6 +381,10 @@ pub trait BlockingRead: Send + Sync { loop { if g.buf.capacity() - g.buf.len() < g.next { g.buf.reserve(g.next); + // # Safety + // + // We make sure that the length of buf is maintained correctly. + #[deny(clippy::uninit_vec)] unsafe { g.buf.set_len(g.buf.capacity()); } diff --git a/core/src/raw/rps.rs b/core/src/raw/rps.rs index 17e4470ae..10b3c7159 100644 --- a/core/src/raw/rps.rs +++ b/core/src/raw/rps.rs @@ -97,13 +97,13 @@ impl<T: Default> From<PresignedRequest> for Request<T> { } /// Reply for `read` operation. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Default)] pub struct RpRead {} impl RpRead { /// Create a new reply for `read`. pub fn new() -> Self { - RpRead {} + RpRead::default() } }
