This is an automated email from the ASF dual-hosted git repository. xuanwo pushed a commit to branch cleanup in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
commit e242d58ea5164ede5cf08cb66c6510b2ea0dea80 Author: Xuanwo <[email protected]> AuthorDate: Thu Nov 16 22:57:43 2023 +0800 Remove not needed async trait Signed-off-by: Xuanwo <[email protected]> --- core/src/raw/oio/list/api.rs | 6 ------ core/src/raw/oio/list/flat_list.rs | 3 +-- core/src/raw/oio/list/hierarchy_list.rs | 3 --- core/src/raw/oio/write/api.rs | 4 ---- core/src/raw/oio/write/append_object_write.rs | 1 - core/src/raw/oio/write/exact_buf_write.rs | 1 - 6 files changed, 1 insertion(+), 17 deletions(-) diff --git a/core/src/raw/oio/list/api.rs b/core/src/raw/oio/list/api.rs index 4b7193591..920b48c56 100644 --- a/core/src/raw/oio/list/api.rs +++ b/core/src/raw/oio/list/api.rs @@ -20,8 +20,6 @@ use std::fmt::Formatter; use std::task::Context; use std::task::Poll; -use async_trait::async_trait; - use crate::raw::oio::Entry; use crate::*; @@ -60,7 +58,6 @@ impl From<ListOperation> for &'static str { } /// Page trait is used by [`raw::Accessor`] to implement `list` operation. -#[async_trait] pub trait List: Send + Sync + 'static { /// Fetch a new page of [`Entry`] /// @@ -72,21 +69,18 @@ pub trait List: Send + Sync + 'static { /// The boxed version of [`List`] pub type Lister = Box<dyn List>; -#[async_trait] impl<P: List + ?Sized> List for Box<P> { fn poll_next(&mut self, cx: &mut Context<'_>) -> Poll<Result<Option<Entry>>> { (**self).poll_next(cx) } } -#[async_trait] impl List for () { fn poll_next(&mut self, _: &mut Context<'_>) -> Poll<Result<Option<Entry>>> { Poll::Ready(Ok(None)) } } -#[async_trait] impl<P: List> List for Option<P> { fn poll_next(&mut self, cx: &mut Context<'_>) -> Poll<Result<Option<Entry>>> { match self { diff --git a/core/src/raw/oio/list/flat_list.rs b/core/src/raw/oio/list/flat_list.rs index 01288a9f8..3328c74b8 100644 --- a/core/src/raw/oio/list/flat_list.rs +++ b/core/src/raw/oio/list/flat_list.rs @@ -19,7 +19,6 @@ use std::task::ready; use std::task::Context; use std::task::Poll; -use async_trait::async_trait; use futures::future::BoxFuture; use futures::FutureExt; @@ -104,7 +103,6 @@ where } } -#[async_trait] impl<A, L> oio::List for FlatLister<A, L> where A: Accessor<Lister = L>, @@ -210,6 +208,7 @@ where #[cfg(test)] mod tests { + use async_trait::async_trait; use std::collections::HashMap; use std::vec; use std::vec::IntoIter; diff --git a/core/src/raw/oio/list/hierarchy_list.rs b/core/src/raw/oio/list/hierarchy_list.rs index c40b160db..0fd4dfdbc 100644 --- a/core/src/raw/oio/list/hierarchy_list.rs +++ b/core/src/raw/oio/list/hierarchy_list.rs @@ -20,8 +20,6 @@ use std::task::ready; use std::task::Context; use std::task::Poll; -use async_trait::async_trait; - use crate::raw::*; use crate::*; @@ -119,7 +117,6 @@ impl<P> HierarchyLister<P> { } } -#[async_trait] impl<P: oio::List> oio::List for HierarchyLister<P> { fn poll_next(&mut self, cx: &mut Context<'_>) -> Poll<Result<Option<oio::Entry>>> { loop { diff --git a/core/src/raw/oio/write/api.rs b/core/src/raw/oio/write/api.rs index cebaffc70..136125657 100644 --- a/core/src/raw/oio/write/api.rs +++ b/core/src/raw/oio/write/api.rs @@ -22,7 +22,6 @@ use std::pin::Pin; use std::task::Context; use std::task::Poll; -use async_trait::async_trait; use pin_project::pin_project; use crate::raw::*; @@ -75,7 +74,6 @@ impl From<WriteOperation> for &'static str { pub type Writer = Box<dyn Write>; /// Write is the trait that OpenDAL returns to callers. -#[async_trait] pub trait Write: Unpin + Send + Sync { /// Write given bytes into writer. /// @@ -95,7 +93,6 @@ pub trait Write: Unpin + Send + Sync { fn poll_abort(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>; } -#[async_trait] impl Write for () { fn poll_write(&mut self, _: &mut Context<'_>, _: &dyn oio::WriteBuf) -> Poll<Result<usize>> { unimplemented!("write is required to be implemented for oio::Write") @@ -119,7 +116,6 @@ impl Write for () { /// `Box<dyn Write>` won't implement `Write` automatically. /// /// To make Writer work as expected, we must add this impl. -#[async_trait] impl<T: Write + ?Sized> Write for Box<T> { fn poll_write(&mut self, cx: &mut Context<'_>, bs: &dyn oio::WriteBuf) -> Poll<Result<usize>> { (**self).poll_write(cx, bs) diff --git a/core/src/raw/oio/write/append_object_write.rs b/core/src/raw/oio/write/append_object_write.rs index d5c030f74..93d182f40 100644 --- a/core/src/raw/oio/write/append_object_write.rs +++ b/core/src/raw/oio/write/append_object_write.rs @@ -77,7 +77,6 @@ impl<W: AppendObjectWrite> AppendObjectWriter<W> { } } -#[async_trait] impl<W> oio::Write for AppendObjectWriter<W> where W: AppendObjectWrite, diff --git a/core/src/raw/oio/write/exact_buf_write.rs b/core/src/raw/oio/write/exact_buf_write.rs index 02ab9d926..122e342c1 100644 --- a/core/src/raw/oio/write/exact_buf_write.rs +++ b/core/src/raw/oio/write/exact_buf_write.rs @@ -102,7 +102,6 @@ mod tests { buf: Vec<u8>, } - #[async_trait] impl Write for MockWriter { fn poll_write(&mut self, _: &mut Context<'_>, bs: &dyn WriteBuf) -> Poll<Result<usize>> { debug!(
