This is an automated email from the ASF dual-hosted git repository. xuanwo pushed a commit to branch polish-lister in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
commit 4516c9d440002f73b4fe653b6bed9f2fd51c7658 Author: Xuanwo <[email protected]> AuthorDate: Wed Nov 15 23:05:29 2023 +0800 Make clippy happy Signed-off-by: Xuanwo <[email protected]> --- core/src/raw/oio/list/into_flat_page.rs | 5 ++++- core/src/raw/oio/list/into_hierarchy_pager.rs | 8 +++++--- core/src/services/webhdfs/lister.rs | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/core/src/raw/oio/list/into_flat_page.rs b/core/src/raw/oio/list/into_flat_page.rs index d335956a5..5ec6fbe0f 100644 --- a/core/src/raw/oio/list/into_flat_page.rs +++ b/core/src/raw/oio/list/into_flat_page.rs @@ -24,6 +24,9 @@ use futures::FutureExt; use crate::raw::*; use crate::*; +/// ListFuture is the future returned while calling async list. +type ListFuture<A, L> = BoxFuture<'static, (A, oio::Entry, Result<(RpList, L)>)>; + /// to_flat_lister is used to make a hierarchy lister flat. pub fn into_flat_page<A: Accessor, P>(acc: A, path: &str) -> FlatLister<A, P> { #[cfg(debug_assertions)] @@ -86,7 +89,7 @@ pub struct FlatLister<A: Accessor, L> { next_dir: Option<oio::Entry>, active_lister: Vec<(Option<oio::Entry>, L)>, - list_future: Option<BoxFuture<'static, (A, oio::Entry, Result<(RpList, L)>)>>, + list_future: Option<ListFuture<A, L>>, } /// # Safety diff --git a/core/src/raw/oio/list/into_hierarchy_pager.rs b/core/src/raw/oio/list/into_hierarchy_pager.rs index 67ea8d761..bc972ff56 100644 --- a/core/src/raw/oio/list/into_hierarchy_pager.rs +++ b/core/src/raw/oio/list/into_hierarchy_pager.rs @@ -164,9 +164,9 @@ mod tests { } impl MockLister { - fn new(inner: &[&'static str]) -> Self { + fn new(inner: Vec<&'static str>) -> Self { Self { - inner: inner.to_vec().into_iter(), + inner: inner.into_iter(), } } } @@ -189,7 +189,9 @@ mod tests { fn test_blocking_list() -> Result<()> { let _ = tracing_subscriber::fmt().with_test_writer().try_init(); - let lister = MockLister::new(&["x/x/", "x/y/", "y/", "x/x/x", "y/y", "xy/", "z", "y/a"]); + let lister = MockLister::new(vec![ + "x/x/", "x/y/", "y/", "x/x/x", "y/y", "xy/", "z", "y/a", + ]); let mut lister = into_hierarchy_page(lister, ""); let mut entries = Vec::default(); diff --git a/core/src/services/webhdfs/lister.rs b/core/src/services/webhdfs/lister.rs index 0857414fc..4a984bb4c 100644 --- a/core/src/services/webhdfs/lister.rs +++ b/core/src/services/webhdfs/lister.rs @@ -74,7 +74,7 @@ impl oio::PageList for WebhdfsLister { if directory_listing.remaining_entries == 0 { ctx.done = true; - } else if file_statuses.len() > 0 { + } else if !file_statuses.is_empty() { ctx.token = file_statuses.last().unwrap().path_suffix.clone(); }
