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 dfcfe91aa45f445a2b90a7fc8baa60a2b1d2ca42 Author: Xuanwo <[email protected]> AuthorDate: Thu Nov 16 22:53:44 2023 +0800 Format code Signed-off-by: Xuanwo <[email protected]> --- bin/oay/src/services/webdav/service.rs | 2 +- bindings/c/src/entry.rs | 3 +- bindings/c/src/operator_info.rs | 3 +- bindings/c/src/reader.rs | 6 ++-- bindings/java/src/blocking_operator.rs | 4 +-- bindings/java/src/convert.rs | 7 ++-- bindings/java/src/layer.rs | 5 +-- bindings/java/src/operator.rs | 4 +-- bindings/java/src/utility.rs | 7 ++-- bindings/nodejs/src/lib.rs | 2 +- bindings/python/src/file.rs | 6 ++-- bindings/python/src/lister.rs | 2 +- bindings/python/src/operator.rs | 3 +- core/edge/file_write_on_full_disk/src/main.rs | 3 +- core/fuzz/fuzz_reader.rs | 3 +- core/src/layers/immutable_index.rs | 3 +- core/src/layers/prometheus_client.rs | 3 +- core/src/raw/layer.rs | 6 +++- core/src/raw/oio/buf/adaptive.rs | 4 ++- core/src/raw/oio/list/api.rs | 3 +- core/src/raw/oio/list/flat_list.rs | 4 ++- core/src/raw/oio/list/hierarchy_list.rs | 4 ++- core/src/raw/oio/list/page_list.rs | 7 ++-- core/src/raw/oio/read/api.rs | 6 ++-- core/src/raw/oio/read/file_read.rs | 1 - core/src/raw/oio/read/futures_read.rs | 13 +++++--- core/src/raw/oio/read/lazy_read.rs | 16 ++++++---- core/src/raw/oio/read/std_read.rs | 9 ++++-- core/src/raw/oio/read/tokio_read.rs | 15 ++++++--- core/src/raw/serde_util.rs | 12 +++++-- core/src/raw/tests/read.rs | 12 ++++--- core/src/raw/tests/utils.rs | 6 ++-- core/src/raw/tests/write.rs | 9 ++++-- core/src/services/alluxio/backend.rs | 8 ++--- core/src/services/alluxio/core.rs | 10 +++--- core/src/services/alluxio/error.rs | 3 +- core/src/services/alluxio/writer.rs | 4 +-- core/src/services/azfile/backend.rs | 7 ++-- core/src/services/azfile/lister.rs | 5 ++- core/src/services/azfile/writer.rs | 5 ++- core/src/services/cloudflare_kv/error.rs | 8 ++--- core/src/services/d1/backend.rs | 5 ++- core/src/services/d1/error.rs | 8 ++--- core/src/services/d1/model.rs | 12 ++++--- core/src/services/dbfs/backend.rs | 5 ++- core/src/services/dbfs/core.rs | 3 +- core/src/services/dbfs/lister.rs | 3 +- core/src/services/dbfs/reader.rs | 1 - core/src/services/dbfs/writer.rs | 3 +- core/src/services/dropbox/backend.rs | 7 ++-- core/src/services/fs/lister.rs | 4 ++- core/src/services/ftp/backend.rs | 3 +- core/src/services/ftp/lister.rs | 3 +- core/src/services/gridfs/backend.rs | 11 +++++-- core/src/services/hdfs/lister.rs | 4 ++- core/src/services/http/backend.rs | 3 +- core/src/services/libsql/backend.rs | 23 +++++++++----- core/src/services/mongodb/backend.rs | 10 ++++-- core/src/services/mysql/backend.rs | 1 - core/src/services/oss/core.rs | 9 +++--- core/src/services/sftp/backend.rs | 3 +- core/src/services/sftp/lister.rs | 4 ++- core/src/services/sqlite/backend.rs | 3 +- core/src/services/swift/error.rs | 3 +- core/src/types/operator/operator.rs | 3 +- core/src/types/scheme.rs | 2 +- core/tests/behavior/blocking_copy.rs | 3 +- core/tests/behavior/blocking_rename.rs | 3 +- core/tests/behavior/copy.rs | 3 +- core/tests/behavior/fuzz.rs | 46 ++++----------------------- core/tests/behavior/rename.rs | 3 +- core/tests/behavior/utils.rs | 3 +- 72 files changed, 240 insertions(+), 200 deletions(-) diff --git a/bin/oay/src/services/webdav/service.rs b/bin/oay/src/services/webdav/service.rs index 71bc31499..9b5673eb9 100644 --- a/bin/oay/src/services/webdav/service.rs +++ b/bin/oay/src/services/webdav/service.rs @@ -23,10 +23,10 @@ use axum::http::Request; use axum::routing::any_service; use axum::Router; use dav_server::DavHandler; +use dav_server_opendalfs::OpendalFs; use opendal::Operator; use crate::Config; -use dav_server_opendalfs::OpendalFs; pub struct WebdavService { cfg: Arc<Config>, diff --git a/bindings/c/src/entry.rs b/bindings/c/src/entry.rs index 44e9c2f19..f71b65337 100644 --- a/bindings/c/src/entry.rs +++ b/bindings/c/src/entry.rs @@ -15,10 +15,11 @@ // specific language governing permissions and limitations // under the License. -use ::opendal as core; use std::ffi::CString; use std::os::raw::c_char; +use ::opendal as core; + /// \brief opendal_list_entry is the entry under a path, which is listed from the opendal_lister /// /// For examples, please see the comment section of opendal_operator_list() diff --git a/bindings/c/src/operator_info.rs b/bindings/c/src/operator_info.rs index 9785700fd..4d805e4de 100644 --- a/bindings/c/src/operator_info.rs +++ b/bindings/c/src/operator_info.rs @@ -15,7 +15,8 @@ // specific language governing permissions and limitations // under the License. -use std::ffi::{c_char, CString}; +use std::ffi::c_char; +use std::ffi::CString; use ::opendal as core; diff --git a/bindings/c/src/reader.rs b/bindings/c/src/reader.rs index f9c52fc17..d0604aeeb 100644 --- a/bindings/c/src/reader.rs +++ b/bindings/c/src/reader.rs @@ -15,10 +15,12 @@ // specific language governing permissions and limitations // under the License. -use super::*; -use ::opendal as core; use std::io::Read; +use ::opendal as core; + +use super::*; + /// \brief The result type returned by opendal's reader operation. /// /// \note The opendal_reader actually owns a pointer to diff --git a/bindings/java/src/blocking_operator.rs b/bindings/java/src/blocking_operator.rs index a87cd9b44..f2d77302c 100644 --- a/bindings/java/src/blocking_operator.rs +++ b/bindings/java/src/blocking_operator.rs @@ -19,12 +19,12 @@ use jni::objects::JByteArray; use jni::objects::JClass; use jni::objects::JObject; use jni::objects::JString; +use jni::sys::jbyteArray; +use jni::sys::jlong; use jni::sys::jobject; use jni::sys::jobjectArray; use jni::sys::jsize; -use jni::sys::{jbyteArray, jlong}; use jni::JNIEnv; - use opendal::BlockingOperator; use crate::convert::jstring_to_string; diff --git a/bindings/java/src/convert.rs b/bindings/java/src/convert.rs index 115bc9981..e347fffc8 100644 --- a/bindings/java/src/convert.rs +++ b/bindings/java/src/convert.rs @@ -15,10 +15,13 @@ // specific language governing permissions and limitations // under the License. -use jni::objects::{JMap, JObject, JString}; +use std::collections::HashMap; + +use jni::objects::JMap; +use jni::objects::JObject; +use jni::objects::JString; use jni::sys::jlong; use jni::JNIEnv; -use std::collections::HashMap; pub(crate) fn usize_to_jlong(n: Option<usize>) -> jlong { // usize is always >= 0, so we can use -1 to identify the empty value. diff --git a/bindings/java/src/layer.rs b/bindings/java/src/layer.rs index 3706d77f5..7e3ba35fd 100644 --- a/bindings/java/src/layer.rs +++ b/bindings/java/src/layer.rs @@ -18,9 +18,10 @@ use std::time::Duration; use jni::objects::JClass; -use jni::sys::{jboolean, jfloat, jlong}; +use jni::sys::jboolean; +use jni::sys::jfloat; +use jni::sys::jlong; use jni::JNIEnv; - use opendal::layers::RetryLayer; use opendal::Operator; diff --git a/bindings/java/src/operator.rs b/bindings/java/src/operator.rs index e4a13430b..5d05f2102 100644 --- a/bindings/java/src/operator.rs +++ b/bindings/java/src/operator.rs @@ -24,10 +24,10 @@ use jni::objects::JObject; use jni::objects::JString; use jni::objects::JValue; use jni::objects::JValueOwned; +use jni::sys::jlong; +use jni::sys::jobject; use jni::sys::jsize; -use jni::sys::{jlong, jobject}; use jni::JNIEnv; - use opendal::layers::BlockingLayer; use opendal::raw::PresignedRequest; use opendal::Operator; diff --git a/bindings/java/src/utility.rs b/bindings/java/src/utility.rs index b3190db7b..02f382ec8 100644 --- a/bindings/java/src/utility.rs +++ b/bindings/java/src/utility.rs @@ -15,10 +15,11 @@ // specific language governing permissions and limitations // under the License. -use jni::objects::{JClass, JObject}; -use jni::sys::{jobjectArray, jsize}; +use jni::objects::JClass; +use jni::objects::JObject; +use jni::sys::jobjectArray; +use jni::sys::jsize; use jni::JNIEnv; - use opendal::Scheme; use crate::convert::string_to_jstring; diff --git a/bindings/nodejs/src/lib.rs b/bindings/nodejs/src/lib.rs index e994e1fac..3cb8b8670 100644 --- a/bindings/nodejs/src/lib.rs +++ b/bindings/nodejs/src/lib.rs @@ -731,7 +731,7 @@ impl NodeLayer for opendal::layers::RetryLayer { /// retry.jitter = true; /// /// op.layer(retry.build()); -///``` +/// ``` #[derive(Default)] #[napi] pub struct RetryLayer { diff --git a/bindings/python/src/file.rs b/bindings/python/src/file.rs index 8db6452b3..09cc6daeb 100644 --- a/bindings/python/src/file.rs +++ b/bindings/python/src/file.rs @@ -15,14 +15,16 @@ // specific language governing permissions and limitations // under the License. +use std::io::Read; use std::io::Seek; use std::io::SeekFrom; -use std::io::{Read, Write}; +use std::io::Write; use std::ops::DerefMut; use std::sync::Arc; +use futures::AsyncReadExt; use futures::AsyncSeekExt; -use futures::{AsyncReadExt, AsyncWriteExt}; +use futures::AsyncWriteExt; use pyo3::exceptions::PyIOError; use pyo3::exceptions::PyValueError; use pyo3::prelude::*; diff --git a/bindings/python/src/lister.rs b/bindings/python/src/lister.rs index d2e7fe89c..e108ec2dc 100644 --- a/bindings/python/src/lister.rs +++ b/bindings/python/src/lister.rs @@ -15,9 +15,9 @@ // specific language governing permissions and limitations // under the License. -use futures::TryStreamExt; use std::sync::Arc; +use futures::TryStreamExt; use pyo3::exceptions::PyStopAsyncIteration; use pyo3::prelude::*; use pyo3_asyncio::tokio::future_into_py; diff --git a/bindings/python/src/operator.rs b/bindings/python/src/operator.rs index d8e6763af..c8057deac 100644 --- a/bindings/python/src/operator.rs +++ b/bindings/python/src/operator.rs @@ -21,7 +21,8 @@ use std::time::Duration; use pyo3::exceptions::PyValueError; use pyo3::prelude::*; -use pyo3::types::{PyBytes, PyDict}; +use pyo3::types::PyBytes; +use pyo3::types::PyDict; use pyo3_asyncio::tokio::future_into_py; use crate::*; diff --git a/core/edge/file_write_on_full_disk/src/main.rs b/core/edge/file_write_on_full_disk/src/main.rs index 63cfe6cf0..f232ac5ff 100644 --- a/core/edge/file_write_on_full_disk/src/main.rs +++ b/core/edge/file_write_on_full_disk/src/main.rs @@ -15,11 +15,12 @@ // specific language governing permissions and limitations // under the License. +use std::env; + use opendal::services::Fs; use opendal::Operator; use opendal::Result; use rand::prelude::*; -use std::env; #[tokio::main] async fn main() -> Result<()> { diff --git a/core/fuzz/fuzz_reader.rs b/core/fuzz/fuzz_reader.rs index bda286a18..b0f83fc03 100644 --- a/core/fuzz/fuzz_reader.rs +++ b/core/fuzz/fuzz_reader.rs @@ -17,7 +17,8 @@ #![no_main] -use std::fmt::{Debug, Formatter}; +use std::fmt::Debug; +use std::fmt::Formatter; use std::io::SeekFrom; use libfuzzer_sys::arbitrary::Arbitrary; diff --git a/core/src/layers/immutable_index.rs b/core/src/layers/immutable_index.rs index 764f5ecc8..4a57f4e19 100644 --- a/core/src/layers/immutable_index.rs +++ b/core/src/layers/immutable_index.rs @@ -17,7 +17,8 @@ use std::collections::HashSet; use std::fmt::Debug; -use std::task::{Context, Poll}; +use std::task::Context; +use std::task::Poll; use std::vec::IntoIter; use async_trait::async_trait; diff --git a/core/src/layers/prometheus_client.rs b/core/src/layers/prometheus_client.rs index fa9e7ec3d..a43d24f0a 100644 --- a/core/src/layers/prometheus_client.rs +++ b/core/src/layers/prometheus_client.rs @@ -21,7 +21,8 @@ use std::io; use std::sync::Arc; use std::task::Context; use std::task::Poll; -use std::time::{Duration, Instant}; +use std::time::Duration; +use std::time::Instant; use async_trait::async_trait; use bytes::Bytes; diff --git a/core/src/raw/layer.rs b/core/src/raw/layer.rs index 48619c9be..da21eca64 100644 --- a/core/src/raw/layer.rs +++ b/core/src/raw/layer.rs @@ -96,7 +96,11 @@ use crate::*; /// self.inner.list(path, args).await /// } /// -/// fn blocking_list(&self, path: &str, args: OpList) -> Result<(RpList, Self::BlockingLister)> { +/// fn blocking_list( +/// &self, +/// path: &str, +/// args: OpList, +/// ) -> Result<(RpList, Self::BlockingLister)> { /// self.inner.blocking_list(path, args) /// } /// } diff --git a/core/src/raw/oio/buf/adaptive.rs b/core/src/raw/oio/buf/adaptive.rs index abebcb36f..3ebf361b5 100644 --- a/core/src/raw/oio/buf/adaptive.rs +++ b/core/src/raw/oio/buf/adaptive.rs @@ -15,8 +15,10 @@ // specific language governing permissions and limitations // under the License. -use bytes::{Bytes, BytesMut}; use std::cmp; + +use bytes::Bytes; +use bytes::BytesMut; use tokio::io::ReadBuf; /// The default minimum adaptive buffer size is 8 KiB. diff --git a/core/src/raw/oio/list/api.rs b/core/src/raw/oio/list/api.rs index cb6ed0fa0..4b7193591 100644 --- a/core/src/raw/oio/list/api.rs +++ b/core/src/raw/oio/list/api.rs @@ -17,7 +17,8 @@ use std::fmt::Display; use std::fmt::Formatter; -use std::task::{Context, Poll}; +use std::task::Context; +use std::task::Poll; use async_trait::async_trait; diff --git a/core/src/raw/oio/list/flat_list.rs b/core/src/raw/oio/list/flat_list.rs index 2d40b13fd..01288a9f8 100644 --- a/core/src/raw/oio/list/flat_list.rs +++ b/core/src/raw/oio/list/flat_list.rs @@ -15,7 +15,9 @@ // specific language governing permissions and limitations // under the License. -use std::task::{ready, Context, Poll}; +use std::task::ready; +use std::task::Context; +use std::task::Poll; use async_trait::async_trait; use futures::future::BoxFuture; diff --git a/core/src/raw/oio/list/hierarchy_list.rs b/core/src/raw/oio/list/hierarchy_list.rs index 79d26b3ac..c40b160db 100644 --- a/core/src/raw/oio/list/hierarchy_list.rs +++ b/core/src/raw/oio/list/hierarchy_list.rs @@ -16,7 +16,9 @@ // under the License. use std::collections::HashSet; -use std::task::{ready, Context, Poll}; +use std::task::ready; +use std::task::Context; +use std::task::Poll; use async_trait::async_trait; diff --git a/core/src/raw/oio/list/page_list.rs b/core/src/raw/oio/list/page_list.rs index 196f228b0..eb98a98bd 100644 --- a/core/src/raw/oio/list/page_list.rs +++ b/core/src/raw/oio/list/page_list.rs @@ -15,10 +15,13 @@ // specific language governing permissions and limitations // under the License. +use std::collections::VecDeque; +use std::task::ready; +use std::task::Context; +use std::task::Poll; + use async_trait::async_trait; use futures::future::BoxFuture; -use std::collections::VecDeque; -use std::task::{ready, Context, Poll}; use crate::raw::*; use crate::*; diff --git a/core/src/raw/oio/read/api.rs b/core/src/raw/oio/read/api.rs index 098599855..2c25f9981 100644 --- a/core/src/raw/oio/read/api.rs +++ b/core/src/raw/oio/read/api.rs @@ -15,12 +15,14 @@ // specific language governing permissions and limitations // under the License. +use std::cmp; use std::fmt::Display; use std::fmt::Formatter; +use std::io; use std::pin::Pin; +use std::task::ready; +use std::task::Context; use std::task::Poll; -use std::task::{ready, Context}; -use std::{cmp, io}; use bytes::Bytes; use futures::Future; diff --git a/core/src/raw/oio/read/file_read.rs b/core/src/raw/oio/read/file_read.rs index 2c403f4a6..fd8a53775 100644 --- a/core/src/raw/oio/read/file_read.rs +++ b/core/src/raw/oio/read/file_read.rs @@ -16,7 +16,6 @@ // under the License. use std::cmp; - use std::io::SeekFrom; use std::pin::Pin; use std::sync::Arc; diff --git a/core/src/raw/oio/read/futures_read.rs b/core/src/raw/oio/read/futures_read.rs index 03b52bbf7..8b3bd3999 100644 --- a/core/src/raw/oio/read/futures_read.rs +++ b/core/src/raw/oio/read/futures_read.rs @@ -15,14 +15,17 @@ // specific language governing permissions and limitations // under the License. -use crate::raw::*; -use crate::*; +use std::io::SeekFrom; +use std::pin::Pin; +use std::task::Context; +use std::task::Poll; + use bytes::Bytes; use futures::AsyncRead; use futures::AsyncSeek; -use std::io::SeekFrom; -use std::pin::Pin; -use std::task::{Context, Poll}; + +use crate::raw::*; +use crate::*; /// FuturesReader implements [`oio::Read`] via [`AsyncRead`] + [`AsyncSeek`]. pub struct FuturesReader<R: AsyncRead + AsyncSeek> { diff --git a/core/src/raw/oio/read/lazy_read.rs b/core/src/raw/oio/read/lazy_read.rs index 89705deff..f6237f656 100644 --- a/core/src/raw/oio/read/lazy_read.rs +++ b/core/src/raw/oio/read/lazy_read.rs @@ -15,15 +15,19 @@ // specific language governing permissions and limitations // under the License. -use crate::raw::*; -use crate::*; -use bytes::Bytes; -use futures::future::BoxFuture; -use futures::Future; use std::io::SeekFrom; use std::pin::Pin; use std::sync::Arc; -use std::task::{ready, Context, Poll}; +use std::task::ready; +use std::task::Context; +use std::task::Poll; + +use bytes::Bytes; +use futures::future::BoxFuture; +use futures::Future; + +use crate::raw::*; +use crate::*; /// LazyReader implements [`oio::Read`] in a lazy way. /// diff --git a/core/src/raw/oio/read/std_read.rs b/core/src/raw/oio/read/std_read.rs index 926b9abb3..d28f8d5ca 100644 --- a/core/src/raw/oio/read/std_read.rs +++ b/core/src/raw/oio/read/std_read.rs @@ -15,11 +15,14 @@ // specific language governing permissions and limitations // under the License. +use std::io::Read; +use std::io::Seek; +use std::io::SeekFrom; + +use bytes::Bytes; + use crate::raw::*; use crate::*; -use bytes::Bytes; -use std::io::Seek; -use std::io::{Read, SeekFrom}; /// FuturesReader implements [`oio::BlockingRead`] via [`Read`] + [`Seek`]. pub struct StdReader<R: Read + Seek> { diff --git a/core/src/raw/oio/read/tokio_read.rs b/core/src/raw/oio/read/tokio_read.rs index 966973bdc..37aabc147 100644 --- a/core/src/raw/oio/read/tokio_read.rs +++ b/core/src/raw/oio/read/tokio_read.rs @@ -15,14 +15,19 @@ // specific language governing permissions and limitations // under the License. -use crate::raw::*; -use crate::*; -use bytes::Bytes; use std::io::SeekFrom; use std::pin::Pin; -use std::task::{ready, Context, Poll}; +use std::task::ready; +use std::task::Context; +use std::task::Poll; + +use bytes::Bytes; +use tokio::io::AsyncRead; use tokio::io::AsyncSeek; -use tokio::io::{AsyncRead, ReadBuf}; +use tokio::io::ReadBuf; + +use crate::raw::*; +use crate::*; /// FuturesReader implements [`oio::Read`] via [`AsyncRead`] + [`AsyncSeek`]. pub struct TokioReader<R: AsyncRead + AsyncSeek> { diff --git a/core/src/raw/serde_util.rs b/core/src/raw/serde_util.rs index 5edde1dde..09ab11cb4 100644 --- a/core/src/raw/serde_util.rs +++ b/core/src/raw/serde_util.rs @@ -15,12 +15,17 @@ // specific language governing permissions and limitations // under the License. -use serde::de::value::{MapDeserializer, SeqDeserializer}; -use serde::de::{self, Deserializer, IntoDeserializer, Visitor}; use std::collections::hash_map::IntoIter; use std::collections::HashMap; use std::iter::empty; +use serde::de::value::MapDeserializer; +use serde::de::value::SeqDeserializer; +use serde::de::Deserializer; +use serde::de::IntoDeserializer; +use serde::de::Visitor; +use serde::de::{self}; + use crate::*; /// Parse xml deserialize error into opendal::Error. @@ -303,9 +308,10 @@ impl<'de> Deserializer<'de> for Pair { #[cfg(test)] mod tests { - use super::*; use serde::Deserialize; + use super::*; + #[derive(Debug, Default, Deserialize, Eq, PartialEq)] #[serde(default)] #[non_exhaustive] diff --git a/core/src/raw/tests/read.rs b/core/src/raw/tests/read.rs index 526af48e5..6c6a3b3d2 100644 --- a/core/src/raw/tests/read.rs +++ b/core/src/raw/tests/read.rs @@ -15,12 +15,16 @@ // specific language governing permissions and limitations // under the License. +use std::io::SeekFrom; + +use bytes::Bytes; +use rand::thread_rng; +use rand::RngCore; +use sha2::Digest; +use sha2::Sha256; + use crate::raw::*; use crate::*; -use bytes::Bytes; -use rand::{thread_rng, RngCore}; -use sha2::{Digest, Sha256}; -use std::io::SeekFrom; /// ReadAction represents a read action. #[derive(Debug, Clone, Eq, PartialEq)] diff --git a/core/src/raw/tests/utils.rs b/core/src/raw/tests/utils.rs index 2ecda5b79..9456b966c 100644 --- a/core/src/raw/tests/utils.rs +++ b/core/src/raw/tests/utils.rs @@ -15,12 +15,14 @@ // specific language governing permissions and limitations // under the License. -use crate::*; -use once_cell::sync::Lazy; use std::collections::HashMap; use std::env; use std::str::FromStr; +use once_cell::sync::Lazy; + +use crate::*; + /// TEST_RUNTIME is the runtime used for running tests. pub static TEST_RUNTIME: Lazy<tokio::runtime::Runtime> = Lazy::new(|| { tokio::runtime::Builder::new_multi_thread() diff --git a/core/src/raw/tests/write.rs b/core/src/raw/tests/write.rs index 511d5f143..d41ac28a0 100644 --- a/core/src/raw/tests/write.rs +++ b/core/src/raw/tests/write.rs @@ -15,9 +15,12 @@ // specific language governing permissions and limitations // under the License. -use bytes::{Bytes, BytesMut}; -use rand::{thread_rng, RngCore}; -use sha2::{Digest, Sha256}; +use bytes::Bytes; +use bytes::BytesMut; +use rand::thread_rng; +use rand::RngCore; +use sha2::Digest; +use sha2::Sha256; /// WriteAction represents a read action. #[derive(Debug, Clone, Eq, PartialEq)] diff --git a/core/src/services/alluxio/backend.rs b/core/src/services/alluxio/backend.rs index b9fa28695..8cbf902d4 100644 --- a/core/src/services/alluxio/backend.rs +++ b/core/src/services/alluxio/backend.rs @@ -24,12 +24,12 @@ use async_trait::async_trait; use log::debug; use serde::Deserialize; -use crate::raw::*; -use crate::*; - +use super::core::AlluxioCore; +use super::lister::AlluxioLister; use super::writer::AlluxioWriter; use super::writer::AlluxioWriters; -use super::{core::AlluxioCore, lister::AlluxioLister}; +use crate::raw::*; +use crate::*; /// Config for alluxio services support. #[derive(Default, Deserialize)] diff --git a/core/src/services/alluxio/core.rs b/core/src/services/alluxio/core.rs index a68e0bcdc..111f35718 100644 --- a/core/src/services/alluxio/core.rs +++ b/core/src/services/alluxio/core.rs @@ -18,19 +18,17 @@ use std::fmt::Debug; use std::fmt::Formatter; -use http::Request; - use http::header::RANGE; +use http::Request; use http::Response; use http::StatusCode; +use serde::Deserialize; +use serde::Serialize; -use serde::{Deserialize, Serialize}; - +use super::error::parse_error; use crate::raw::*; use crate::*; -use super::error::parse_error; - #[derive(Debug, Serialize)] struct CreateFileRequest { #[serde(skip_serializing_if = "Option::is_none")] diff --git a/core/src/services/alluxio/error.rs b/core/src/services/alluxio/error.rs index 0f19d7a29..d07fece31 100644 --- a/core/src/services/alluxio/error.rs +++ b/core/src/services/alluxio/error.rs @@ -62,10 +62,11 @@ pub async fn parse_error(resp: Response<IncomingAsyncBody>) -> Result<Error> { #[cfg(test)] mod tests { - use super::*; use futures::stream; use http::StatusCode; + use super::*; + /// Error response example is from https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html #[tokio::test] async fn test_parse_error() { diff --git a/core/src/services/alluxio/writer.rs b/core/src/services/alluxio/writer.rs index 404304d84..a45fdbdf7 100644 --- a/core/src/services/alluxio/writer.rs +++ b/core/src/services/alluxio/writer.rs @@ -23,13 +23,11 @@ use std::task::Poll; use async_trait::async_trait; use futures::future::BoxFuture; +use super::core::AlluxioCore; use crate::raw::oio::WriteBuf; use crate::raw::*; - use crate::*; -use super::core::AlluxioCore; - pub type AlluxioWriters = AlluxioWriter; pub struct AlluxioWriter { diff --git a/core/src/services/azfile/backend.rs b/core/src/services/azfile/backend.rs index 3b87cb1f0..e28e1acd6 100644 --- a/core/src/services/azfile/backend.rs +++ b/core/src/services/azfile/backend.rs @@ -27,14 +27,13 @@ use reqsign::AzureStorageConfig; use reqsign::AzureStorageLoader; use reqsign::AzureStorageSigner; -use crate::raw::*; -use crate::services::azfile::lister::AzfileLister; -use crate::*; - use super::core::AzfileCore; use super::error::parse_error; use super::writer::AzfileWriter; use super::writer::AzfileWriters; +use crate::raw::*; +use crate::services::azfile::lister::AzfileLister; +use crate::*; /// Default endpoint of Azure File services. const DEFAULT_AZFILE_ENDPOINT_SUFFIX: &str = "file.core.windows.net"; diff --git a/core/src/services/azfile/lister.rs b/core/src/services/azfile/lister.rs index cdd8fc980..bb9f8f73b 100644 --- a/core/src/services/azfile/lister.rs +++ b/core/src/services/azfile/lister.rs @@ -22,11 +22,10 @@ use http::StatusCode; use quick_xml::de::from_str; use serde::Deserialize; -use crate::raw::*; -use crate::*; - use super::core::AzfileCore; use super::error::parse_error; +use crate::raw::*; +use crate::*; pub struct AzfileLister { core: Arc<AzfileCore>, diff --git a/core/src/services/azfile/writer.rs b/core/src/services/azfile/writer.rs index 4f903a9b2..e6e199997 100644 --- a/core/src/services/azfile/writer.rs +++ b/core/src/services/azfile/writer.rs @@ -20,11 +20,10 @@ use std::sync::Arc; use async_trait::async_trait; use http::StatusCode; -use crate::raw::*; -use crate::*; - use super::core::AzfileCore; use super::error::parse_error; +use crate::raw::*; +use crate::*; pub type AzfileWriters = oio::TwoWaysWriter<oio::OneShotWriter<AzfileWriter>, oio::AppendObjectWriter<AzfileWriter>>; diff --git a/core/src/services/cloudflare_kv/error.rs b/core/src/services/cloudflare_kv/error.rs index 10f4c4aaa..eb323f9ed 100644 --- a/core/src/services/cloudflare_kv/error.rs +++ b/core/src/services/cloudflare_kv/error.rs @@ -18,17 +18,15 @@ use bytes::Buf; use http::Response; use http::StatusCode; +use serde_json::de; +use super::backend::CfKvError; +use super::backend::CfKvResponse; use crate::raw::*; use crate::Error; use crate::ErrorKind; use crate::Result; -use serde_json::de; - -use super::backend::CfKvError; -use super::backend::CfKvResponse; - /// Parse error response into Error. pub(crate) async fn parse_error(resp: Response<IncomingAsyncBody>) -> Result<Error> { let (parts, body) = resp.into_parts(); diff --git a/core/src/services/d1/backend.rs b/core/src/services/d1/backend.rs index 15e8d2854..5555c6bd5 100644 --- a/core/src/services/d1/backend.rs +++ b/core/src/services/d1/backend.rs @@ -25,14 +25,13 @@ use http::Request; use http::StatusCode; use serde_json::Value; +use super::error::parse_error; +use super::model::D1Response; use crate::raw::adapters::kv; use crate::raw::*; use crate::ErrorKind; use crate::*; -use super::error::parse_error; -use super::model::D1Response; - #[doc = include_str!("docs.md")] #[derive(Default)] pub struct D1Builder { diff --git a/core/src/services/d1/error.rs b/core/src/services/d1/error.rs index 2a2f75de4..96ac072e0 100644 --- a/core/src/services/d1/error.rs +++ b/core/src/services/d1/error.rs @@ -18,17 +18,15 @@ use bytes::Buf; use http::Response; use http::StatusCode; +use serde_json::de; +use super::model::D1Error; +use super::model::D1Response; use crate::raw::*; use crate::Error; use crate::ErrorKind; use crate::Result; -use serde_json::de; - -use super::model::D1Error; -use super::model::D1Response; - /// Parse error response into Error. pub async fn parse_error(resp: Response<IncomingAsyncBody>) -> Result<Error> { let (parts, body) = resp.into_parts(); diff --git a/core/src/services/d1/model.rs b/core/src/services/d1/model.rs index c086af0d5..fee83bb13 100644 --- a/core/src/services/d1/model.rs +++ b/core/src/services/d1/model.rs @@ -15,12 +15,16 @@ // specific language governing permissions and limitations // under the License. -use crate::Error; -use bytes::Bytes; -use serde::{Deserialize, Serialize}; -use serde_json::{Map, Value}; use std::fmt::Debug; +use bytes::Bytes; +use serde::Deserialize; +use serde::Serialize; +use serde_json::Map; +use serde_json::Value; + +use crate::Error; + /// response data from d1 #[derive(Deserialize, Debug)] pub struct D1Response { diff --git a/core/src/services/dbfs/backend.rs b/core/src/services/dbfs/backend.rs index 8da90e2b7..4d85c3aad 100644 --- a/core/src/services/dbfs/backend.rs +++ b/core/src/services/dbfs/backend.rs @@ -25,14 +25,13 @@ use http::StatusCode; use log::debug; use serde::Deserialize; -use crate::raw::*; -use crate::*; - use super::core::DbfsCore; use super::error::parse_error; use super::lister::DbfsLister; use super::reader::DbfsReader; use super::writer::DbfsWriter; +use crate::raw::*; +use crate::*; /// [Dbfs](https://docs.databricks.com/api/azure/workspace/dbfs)'s REST API support. #[doc = include_str!("docs.md")] diff --git a/core/src/services/dbfs/core.rs b/core/src/services/dbfs/core.rs index 44e20e571..80541d31e 100644 --- a/core/src/services/dbfs/core.rs +++ b/core/src/services/dbfs/core.rs @@ -26,11 +26,10 @@ use http::Response; use http::StatusCode; use serde_json::json; +use super::error::parse_error; use crate::raw::*; use crate::*; -use super::error::parse_error; - pub struct DbfsCore { pub root: String, pub endpoint: String, diff --git a/core/src/services/dbfs/lister.rs b/core/src/services/dbfs/lister.rs index 254afdc58..e86dd3381 100644 --- a/core/src/services/dbfs/lister.rs +++ b/core/src/services/dbfs/lister.rs @@ -21,12 +21,11 @@ use async_trait::async_trait; use http::StatusCode; use serde::Deserialize; +use super::error::parse_error; use crate::raw::*; use crate::services::dbfs::core::DbfsCore; use crate::*; -use super::error::parse_error; - pub struct DbfsLister { core: Arc<DbfsCore>, path: String, diff --git a/core/src/services/dbfs/reader.rs b/core/src/services/dbfs/reader.rs index a74ddf719..1cc56ea89 100644 --- a/core/src/services/dbfs/reader.rs +++ b/core/src/services/dbfs/reader.rs @@ -31,7 +31,6 @@ use futures::future::BoxFuture; use serde::Deserialize; use super::core::DbfsCore; - use crate::raw::*; use crate::*; diff --git a/core/src/services/dbfs/writer.rs b/core/src/services/dbfs/writer.rs index 04dbe4611..f2db1124f 100644 --- a/core/src/services/dbfs/writer.rs +++ b/core/src/services/dbfs/writer.rs @@ -20,13 +20,12 @@ use std::sync::Arc; use async_trait::async_trait; use http::StatusCode; +use super::error::parse_error; use crate::raw::oio::WriteBuf; use crate::raw::*; use crate::services::dbfs::core::DbfsCore; use crate::*; -use super::error::parse_error; - pub struct DbfsWriter { core: Arc<DbfsCore>, path: String, diff --git a/core/src/services/dropbox/backend.rs b/core/src/services/dropbox/backend.rs index 6aef1c9f7..78a552141 100644 --- a/core/src/services/dropbox/backend.rs +++ b/core/src/services/dropbox/backend.rs @@ -26,13 +26,12 @@ use http::StatusCode; use once_cell::sync::Lazy; use serde::Deserialize; -use crate::raw::*; -use crate::services::dropbox::error::DropboxErrorResponse; -use crate::*; - use super::core::DropboxCore; use super::error::parse_error; use super::writer::DropboxWriter; +use crate::raw::*; +use crate::services::dropbox::error::DropboxErrorResponse; +use crate::*; static BACKOFF: Lazy<ExponentialBuilder> = Lazy::new(|| { ExponentialBuilder::default() diff --git a/core/src/services/fs/lister.rs b/core/src/services/fs/lister.rs index 0dd3dcf56..c101c08d6 100644 --- a/core/src/services/fs/lister.rs +++ b/core/src/services/fs/lister.rs @@ -18,7 +18,9 @@ use std::fs::FileType; use std::path::Path; use std::path::PathBuf; -use std::task::{ready, Context, Poll}; +use std::task::ready; +use std::task::Context; +use std::task::Poll; use async_trait::async_trait; use futures::future::BoxFuture; diff --git a/core/src/services/ftp/backend.rs b/core/src/services/ftp/backend.rs index 23570ac46..c5ad50f05 100644 --- a/core/src/services/ftp/backend.rs +++ b/core/src/services/ftp/backend.rs @@ -28,6 +28,7 @@ use futures::AsyncRead; use futures::AsyncReadExt; use http::Uri; use log::debug; +use serde::Deserialize; use suppaftp::async_native_tls::TlsConnector; use suppaftp::list::File; use suppaftp::types::FileType; @@ -46,8 +47,6 @@ use crate::raw::*; use crate::services::ftp::writer::FtpWriters; use crate::*; -use serde::Deserialize; - /// Config for Ftpservices support. #[derive(Default, Deserialize)] #[serde(default)] diff --git a/core/src/services/ftp/lister.rs b/core/src/services/ftp/lister.rs index aa9a902bf..099fee930 100644 --- a/core/src/services/ftp/lister.rs +++ b/core/src/services/ftp/lister.rs @@ -17,7 +17,8 @@ use std::str; use std::str::FromStr; -use std::task::{Context, Poll}; +use std::task::Context; +use std::task::Poll; use std::vec::IntoIter; use async_trait::async_trait; diff --git a/core/src/services/gridfs/backend.rs b/core/src/services/gridfs/backend.rs index 606b464d3..a98924214 100644 --- a/core/src/services/gridfs/backend.rs +++ b/core/src/services/gridfs/backend.rs @@ -15,12 +15,17 @@ // specific language governing permissions and limitations // under the License. +use std::fmt::Debug; +use std::fmt::Formatter; + use async_trait::async_trait; -use futures::{AsyncWriteExt, StreamExt}; +use futures::AsyncWriteExt; +use futures::StreamExt; use mongodb::bson::doc; -use mongodb::options::{ClientOptions, GridFsBucketOptions, GridFsFindOptions}; +use mongodb::options::ClientOptions; +use mongodb::options::GridFsBucketOptions; +use mongodb::options::GridFsFindOptions; use mongodb::GridFsBucket; -use std::fmt::{Debug, Formatter}; use tokio::sync::OnceCell; use crate::raw::adapters::kv; diff --git a/core/src/services/hdfs/lister.rs b/core/src/services/hdfs/lister.rs index 50ba0ba4e..404d159f5 100644 --- a/core/src/services/hdfs/lister.rs +++ b/core/src/services/hdfs/lister.rs @@ -15,8 +15,10 @@ // specific language governing permissions and limitations // under the License. +use std::task::Context; +use std::task::Poll; + use async_trait::async_trait; -use std::task::{Context, Poll}; use crate::raw::*; use crate::EntryMode; diff --git a/core/src/services/http/backend.rs b/core/src/services/http/backend.rs index b10eba4a8..7e1b8b334 100644 --- a/core/src/services/http/backend.rs +++ b/core/src/services/http/backend.rs @@ -27,13 +27,12 @@ use http::Request; use http::Response; use http::StatusCode; use log::debug; +use serde::Deserialize; use super::error::parse_error; use crate::raw::*; use crate::*; -use serde::Deserialize; - /// Config for Http service support. #[derive(Default, Deserialize)] #[serde(default)] diff --git a/core/src/services/libsql/backend.rs b/core/src/services/libsql/backend.rs index 6c078b441..805bbce8e 100644 --- a/core/src/services/libsql/backend.rs +++ b/core/src/services/libsql/backend.rs @@ -21,21 +21,28 @@ use std::str; use async_trait::async_trait; use bytes::Bytes; -use hrana_client_proto::pipeline::{ - ClientMsg, Response, ServerMsg, StreamExecuteReq, StreamExecuteResult, StreamRequest, - StreamResponse, StreamResponseError, StreamResponseOk, -}; +use hrana_client_proto::pipeline::ClientMsg; +use hrana_client_proto::pipeline::Response; +use hrana_client_proto::pipeline::ServerMsg; +use hrana_client_proto::pipeline::StreamExecuteReq; +use hrana_client_proto::pipeline::StreamExecuteResult; +use hrana_client_proto::pipeline::StreamRequest; +use hrana_client_proto::pipeline::StreamResponse; +use hrana_client_proto::pipeline::StreamResponseError; +use hrana_client_proto::pipeline::StreamResponseOk; use hrana_client_proto::Error as PipelineError; -use hrana_client_proto::{Stmt, StmtResult, Value}; -use http::{Request, Uri}; +use hrana_client_proto::Stmt; +use hrana_client_proto::StmtResult; +use hrana_client_proto::Value; +use http::Request; +use http::Uri; use serde::Deserialize; +use super::error::parse_error; use crate::raw::adapters::kv; use crate::raw::*; use crate::*; -use super::error::parse_error; - /// Config for Libsqlservices support. #[derive(Default, Deserialize)] #[serde(default)] diff --git a/core/src/services/mongodb/backend.rs b/core/src/services/mongodb/backend.rs index cafed8fb3..76bdfd011 100644 --- a/core/src/services/mongodb/backend.rs +++ b/core/src/services/mongodb/backend.rs @@ -15,11 +15,15 @@ // specific language governing permissions and limitations // under the License. +use std::fmt::Debug; +use std::fmt::Formatter; + use async_trait::async_trait; +use mongodb::bson::doc; use mongodb::bson::Binary; -use mongodb::bson::{doc, Document}; -use mongodb::options::{ClientOptions, UpdateOptions}; -use std::fmt::{Debug, Formatter}; +use mongodb::bson::Document; +use mongodb::options::ClientOptions; +use mongodb::options::UpdateOptions; use tokio::sync::OnceCell; use crate::raw::adapters::kv; diff --git a/core/src/services/mysql/backend.rs b/core/src/services/mysql/backend.rs index e3b5af5b6..cdc4dd959 100644 --- a/core/src/services/mysql/backend.rs +++ b/core/src/services/mysql/backend.rs @@ -86,7 +86,6 @@ impl MysqlBuilder { /// - `mysql://user:password@localhost:3306/db` /// /// For more information, please refer to [mysql client](https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html) - /// pub fn connection_string(&mut self, v: &str) -> &mut Self { if !v.is_empty() { self.config.connection_string = Some(v.to_string()); diff --git a/core/src/services/oss/core.rs b/core/src/services/oss/core.rs index c90439de1..fad417c4c 100644 --- a/core/src/services/oss/core.rs +++ b/core/src/services/oss/core.rs @@ -15,6 +15,11 @@ // specific language governing permissions and limitations // under the License. +use std::fmt::Debug; +use std::fmt::Formatter; +use std::fmt::Write; +use std::time::Duration; + use bytes::Bytes; use http::header::CACHE_CONTROL; use http::header::CONTENT_DISPOSITION; @@ -32,10 +37,6 @@ use reqsign::AliyunLoader; use reqsign::AliyunOssSigner; use serde::Deserialize; use serde::Serialize; -use std::fmt::Debug; -use std::fmt::Formatter; -use std::fmt::Write; -use std::time::Duration; use crate::raw::*; use crate::*; diff --git a/core/src/services/sftp/backend.rs b/core/src/services/sftp/backend.rs index 47d680ef2..69630025c 100644 --- a/core/src/services/sftp/backend.rs +++ b/core/src/services/sftp/backend.rs @@ -30,6 +30,7 @@ use openssh::SessionBuilder; use openssh_sftp_client::file::TokioCompatFile; use openssh_sftp_client::Sftp; use openssh_sftp_client::SftpOptions; +use serde::Deserialize; use super::error::is_not_found; use super::error::is_sftp_protocol_error; @@ -38,8 +39,6 @@ use super::writer::SftpWriter; use crate::raw::*; use crate::*; -use serde::Deserialize; - /// Config for Sftpservices support. #[derive(Default, Deserialize)] #[serde(default)] diff --git a/core/src/services/sftp/lister.rs b/core/src/services/sftp/lister.rs index eeac58af8..14d0b4843 100644 --- a/core/src/services/sftp/lister.rs +++ b/core/src/services/sftp/lister.rs @@ -16,7 +16,9 @@ // under the License. use std::pin::Pin; -use std::task::{ready, Context, Poll}; +use std::task::ready; +use std::task::Context; +use std::task::Poll; use async_trait::async_trait; use futures::StreamExt; diff --git a/core/src/services/sqlite/backend.rs b/core/src/services/sqlite/backend.rs index 1d6a57432..6cf2df81d 100644 --- a/core/src/services/sqlite/backend.rs +++ b/core/src/services/sqlite/backend.rs @@ -20,7 +20,8 @@ use std::fmt::Debug; use std::fmt::Formatter; use async_trait::async_trait; -use rusqlite::{params, Connection}; +use rusqlite::params; +use rusqlite::Connection; use serde::Deserialize; use tokio::task; diff --git a/core/src/services/swift/error.rs b/core/src/services/swift/error.rs index 48c482ca5..836787ec0 100644 --- a/core/src/services/swift/error.rs +++ b/core/src/services/swift/error.rs @@ -15,7 +15,8 @@ // specific language governing permissions and limitations // under the License. -use bytes::{Buf, Bytes}; +use bytes::Buf; +use bytes::Bytes; use http::Response; use http::StatusCode; use quick_xml::de; diff --git a/core/src/types/operator/operator.rs b/core/src/types/operator/operator.rs index 4461edce8..0d24728f5 100644 --- a/core/src/types/operator/operator.rs +++ b/core/src/types/operator/operator.rs @@ -26,7 +26,8 @@ use futures::TryStreamExt; use super::BlockingOperator; use crate::operator_futures::*; -use crate::raw::oio::{ReadExt, WriteExt}; +use crate::raw::oio::ReadExt; +use crate::raw::oio::WriteExt; use crate::raw::*; use crate::*; diff --git a/core/src/types/scheme.rs b/core/src/types/scheme.rs index f0bf62b73..54ea475f8 100644 --- a/core/src/types/scheme.rs +++ b/core/src/types/scheme.rs @@ -158,7 +158,7 @@ impl Scheme { /// /// let enabled_schemes = Scheme::enabled(); /// if !enabled_schemes.contains(&Scheme::Memory) { - /// panic!("s3 support is not enabled") + /// panic!("s3 support is not enabled") /// } /// ``` pub fn enabled() -> HashSet<Scheme> { diff --git a/core/tests/behavior/blocking_copy.rs b/core/tests/behavior/blocking_copy.rs index 6a6165f26..5d4a1a45a 100644 --- a/core/tests/behavior/blocking_copy.rs +++ b/core/tests/behavior/blocking_copy.rs @@ -16,7 +16,8 @@ // under the License. use anyhow::Result; -use sha2::{Digest, Sha256}; +use sha2::Digest; +use sha2::Sha256; use crate::*; diff --git a/core/tests/behavior/blocking_rename.rs b/core/tests/behavior/blocking_rename.rs index f61f9401e..378299eca 100644 --- a/core/tests/behavior/blocking_rename.rs +++ b/core/tests/behavior/blocking_rename.rs @@ -16,7 +16,8 @@ // under the License. use anyhow::Result; -use sha2::{Digest, Sha256}; +use sha2::Digest; +use sha2::Sha256; use crate::*; diff --git a/core/tests/behavior/copy.rs b/core/tests/behavior/copy.rs index f5fffd094..5a46776f7 100644 --- a/core/tests/behavior/copy.rs +++ b/core/tests/behavior/copy.rs @@ -16,7 +16,8 @@ // under the License. use anyhow::Result; -use sha2::{Digest, Sha256}; +use sha2::Digest; +use sha2::Sha256; use crate::*; diff --git a/core/tests/behavior/fuzz.rs b/core/tests/behavior/fuzz.rs index 772a2c181..cc97c0ea4 100644 --- a/core/tests/behavior/fuzz.rs +++ b/core/tests/behavior/fuzz.rs @@ -19,7 +19,8 @@ use std::io::SeekFrom; use std::vec; use anyhow::Result; -use opendal::raw::tests::{ReadAction, ReadChecker}; +use opendal::raw::tests::ReadAction; +use opendal::raw::tests::ReadChecker; use opendal::raw::BytesRange; use crate::*; @@ -110,25 +111,8 @@ pub async fn test_fuzz_issue_2717(op: Operator) -> Result<()> { /// FuzzInput { /// path: "06ae5d93-c0e9-43f2-ae5a-225cfaaa40a0", /// size: 1, -/// range: BytesRange( -/// Some( -/// 0, -/// ), -/// None, -/// ), -/// actions: [ -/// Seek( -/// Current( -/// 1, -/// ), -/// ), -/// Next, -/// Seek( -/// End( -/// -1, -/// ), -/// ), -/// ], +/// range: BytesRange(Some(0), None), +/// actions: [Seek(Current(1)), Next, Seek(End(-1))], /// } /// ``` pub async fn test_fuzz_pr_3395_case_1(op: Operator) -> Result<()> { @@ -148,26 +132,8 @@ pub async fn test_fuzz_pr_3395_case_1(op: Operator) -> Result<()> { /// FuzzInput { /// path: "e6056989-7c7c-4075-b975-5ae380884333", /// size: 1, -/// range: BytesRange( -/// Some( -/// 0, -/// ), -/// None, -/// ), -/// actions: [ -/// Next, -/// Seek( -/// Current( -/// 1, -/// ), -/// ), -/// Next, -/// Seek( -/// End( -/// 0, -/// ), -/// ), -/// ], +/// range: BytesRange(Some(0), None), +/// actions: [Next, Seek(Current(1)), Next, Seek(End(0))], /// } /// ``` pub async fn test_fuzz_pr_3395_case_2(op: Operator) -> Result<()> { diff --git a/core/tests/behavior/rename.rs b/core/tests/behavior/rename.rs index 29dd3de6a..eb0a74477 100644 --- a/core/tests/behavior/rename.rs +++ b/core/tests/behavior/rename.rs @@ -16,7 +16,8 @@ // under the License. use anyhow::Result; -use sha2::{Digest, Sha256}; +use sha2::Digest; +use sha2::Sha256; use crate::*; diff --git a/core/tests/behavior/utils.rs b/core/tests/behavior/utils.rs index 60302a91a..0bb0ed607 100644 --- a/core/tests/behavior/utils.rs +++ b/core/tests/behavior/utils.rs @@ -26,14 +26,13 @@ use futures::Future; use libtest_mimic::Failed; use libtest_mimic::Trial; use log::debug; +use opendal::raw::tests::TEST_RUNTIME; use opendal::*; use rand::distributions::uniform::SampleRange; use rand::prelude::*; use sha2::Digest; use sha2::Sha256; -use opendal::raw::tests::TEST_RUNTIME; - pub fn gen_bytes_with_range(range: impl SampleRange<usize>) -> (Vec<u8>, usize) { let mut rng = thread_rng();
