This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch poll-write
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
The following commit(s) were added to refs/heads/poll-write by this push:
new fb14acb63 Format code
fb14acb63 is described below
commit fb14acb63cd5ee25185784945bd05ed03a77a193
Author: Xuanwo <[email protected]>
AuthorDate: Mon Sep 11 18:19:04 2023 +0800
Format code
Signed-off-by: Xuanwo <[email protected]>
---
bindings/cpp/src/lib.rs | 3 ++-
bindings/cpp/src/lister.rs | 3 ++-
bindings/cpp/src/reader.rs | 3 ++-
bindings/cpp/src/types.rs | 3 ++-
core/benches/oio/utils.rs | 4 +++-
core/benches/oio/write.rs | 3 ++-
core/src/layers/complete.rs | 3 ++-
core/src/layers/logging.rs | 3 ++-
core/src/layers/oteltrace.rs | 3 ++-
core/src/raw/adapters/kv/backend.rs | 4 +++-
core/src/raw/adapters/typed_kv/backend.rs | 4 +++-
core/src/raw/oio/buf.rs | 7 +++++--
core/src/raw/oio/read/cloneable_read.rs | 11 +++++++----
core/src/raw/oio/read/into_read_from_stream.rs | 12 ++++++++----
core/src/raw/oio/write/api.rs | 3 ++-
core/src/raw/oio/write/append_object_write.rs | 5 ++++-
core/src/raw/oio/write/compose_write.rs | 4 +++-
core/src/raw/oio/write/exact_buf_write.rs | 7 +++++--
core/src/raw/oio/write/multipart_upload_write.rs | 7 +++++--
core/src/raw/oio/write/one_shot_write.rs | 5 ++++-
core/src/raw/oio/write/range_write.rs | 5 ++++-
core/src/services/fs/writer.rs | 4 +++-
core/src/services/ftp/writer.rs | 5 ++++-
core/src/services/ghac/writer.rs | 5 ++++-
core/src/services/hdfs/writer.rs | 3 ++-
core/src/services/obs/writer.rs | 2 +-
core/src/services/sftp/writer.rs | 6 ++++--
core/src/types/operator/operator.rs | 3 ++-
core/src/types/writer.rs | 3 ++-
core/tests/behavior/write.rs | 3 ++-
30 files changed, 96 insertions(+), 40 deletions(-)
diff --git a/bindings/cpp/src/lib.rs b/bindings/cpp/src/lib.rs
index 4928719f0..e59c1482d 100644
--- a/bindings/cpp/src/lib.rs
+++ b/bindings/cpp/src/lib.rs
@@ -19,11 +19,12 @@ mod lister;
mod reader;
mod types;
+use std::str::FromStr;
+
use anyhow::Result;
use lister::Lister;
use opendal as od;
use reader::Reader;
-use std::str::FromStr;
#[cxx::bridge(namespace = "opendal::ffi")]
mod ffi {
diff --git a/bindings/cpp/src/lister.rs b/bindings/cpp/src/lister.rs
index 573e7a669..51b3007eb 100644
--- a/bindings/cpp/src/lister.rs
+++ b/bindings/cpp/src/lister.rs
@@ -15,10 +15,11 @@
// specific language governing permissions and limitations
// under the License.
-use super::ffi;
use anyhow::Result;
use opendal as od;
+use super::ffi;
+
pub struct Lister(pub od::BlockingLister);
impl Lister {
diff --git a/bindings/cpp/src/reader.rs b/bindings/cpp/src/reader.rs
index 9ad55d714..6b56d1a4b 100644
--- a/bindings/cpp/src/reader.rs
+++ b/bindings/cpp/src/reader.rs
@@ -15,11 +15,12 @@
// specific language governing permissions and limitations
// under the License.
-use super::ffi;
use anyhow::Result;
use od::raw::oio::BlockingRead;
use opendal as od;
+use super::ffi;
+
pub struct Reader(pub od::BlockingReader);
impl Reader {
diff --git a/bindings/cpp/src/types.rs b/bindings/cpp/src/types.rs
index 044c7f385..c0552ad72 100644
--- a/bindings/cpp/src/types.rs
+++ b/bindings/cpp/src/types.rs
@@ -15,9 +15,10 @@
// specific language governing permissions and limitations
// under the License.
-use super::ffi;
use opendal as od;
+use super::ffi;
+
impl From<od::Metadata> for ffi::Metadata {
fn from(meta: od::Metadata) -> Self {
let mode = meta.mode().into();
diff --git a/core/benches/oio/utils.rs b/core/benches/oio/utils.rs
index fe418922e..338587062 100644
--- a/core/benches/oio/utils.rs
+++ b/core/benches/oio/utils.rs
@@ -15,12 +15,14 @@
// specific language governing permissions and limitations
// under the License.
+use std::task::Context;
+use std::task::Poll;
+
use async_trait::async_trait;
use bytes::Bytes;
use opendal::raw::oio;
use rand::prelude::ThreadRng;
use rand::RngCore;
-use std::task::{Context, Poll};
/// BlackHoleWriter will discard all data written to it so we can measure the
buffer's cost.
pub struct BlackHoleWriter;
diff --git a/core/benches/oio/write.rs b/core/benches/oio/write.rs
index 2ce7d3a2e..7329eb90d 100644
--- a/core/benches/oio/write.rs
+++ b/core/benches/oio/write.rs
@@ -18,7 +18,8 @@
use bytes::Buf;
use criterion::Criterion;
use once_cell::sync::Lazy;
-use opendal::raw::oio::{ExactBufWriter, WriteExt};
+use opendal::raw::oio::ExactBufWriter;
+use opendal::raw::oio::WriteExt;
use rand::thread_rng;
use size::Size;
diff --git a/core/src/layers/complete.rs b/core/src/layers/complete.rs
index 4b856e8a1..cc767f90e 100644
--- a/core/src/layers/complete.rs
+++ b/core/src/layers/complete.rs
@@ -19,8 +19,9 @@ use std::fmt::Debug;
use std::fmt::Formatter;
use std::io;
use std::sync::Arc;
+use std::task::ready;
+use std::task::Context;
use std::task::Poll;
-use std::task::{ready, Context};
use async_trait::async_trait;
use bytes::Bytes;
diff --git a/core/src/layers/logging.rs b/core/src/layers/logging.rs
index 71bb7c099..457fc2612 100644
--- a/core/src/layers/logging.rs
+++ b/core/src/layers/logging.rs
@@ -17,8 +17,9 @@
use std::fmt::Debug;
use std::io;
+use std::task::ready;
+use std::task::Context;
use std::task::Poll;
-use std::task::{ready, Context};
use async_trait::async_trait;
use bytes::Bytes;
diff --git a/core/src/layers/oteltrace.rs b/core/src/layers/oteltrace.rs
index b0d80fe1d..1591ae6af 100644
--- a/core/src/layers/oteltrace.rs
+++ b/core/src/layers/oteltrace.rs
@@ -16,7 +16,8 @@
// under the License.
use std::io;
-use std::task::{Context, Poll};
+use std::task::Context;
+use std::task::Poll;
use async_trait::async_trait;
use bytes::Bytes;
diff --git a/core/src/raw/adapters/kv/backend.rs
b/core/src/raw/adapters/kv/backend.rs
index b664a76a9..2b843ad3e 100644
--- a/core/src/raw/adapters/kv/backend.rs
+++ b/core/src/raw/adapters/kv/backend.rs
@@ -16,7 +16,9 @@
// under the License.
use std::sync::Arc;
-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/adapters/typed_kv/backend.rs
b/core/src/raw/adapters/typed_kv/backend.rs
index 8ddc0f524..4a2ae17ab 100644
--- a/core/src/raw/adapters/typed_kv/backend.rs
+++ b/core/src/raw/adapters/typed_kv/backend.rs
@@ -16,7 +16,9 @@
// under the License.
use std::sync::Arc;
-use std::task::{ready, Context, Poll};
+use std::task::ready;
+use std::task::Context;
+use std::task::Poll;
use async_trait::async_trait;
use bytes::Bytes;
diff --git a/core/src/raw/oio/buf.rs b/core/src/raw/oio/buf.rs
index 36d67a2e3..3e6d42264 100644
--- a/core/src/raw/oio/buf.rs
+++ b/core/src/raw/oio/buf.rs
@@ -15,8 +15,11 @@
// specific language governing permissions and limitations
// under the License.
-use bytes::{Bytes, BytesMut};
-use std::{cmp, ptr};
+use std::cmp;
+use std::ptr;
+
+use bytes::Bytes;
+use bytes::BytesMut;
/// WriteBuf is used in [`oio::Write`] to provide a trait similar to
[`bytes::Buf`].
///
diff --git a/core/src/raw/oio/read/cloneable_read.rs
b/core/src/raw/oio/read/cloneable_read.rs
index 2ccd50042..a5fe92184 100644
--- a/core/src/raw/oio/read/cloneable_read.rs
+++ b/core/src/raw/oio/read/cloneable_read.rs
@@ -15,12 +15,15 @@
// specific language governing permissions and limitations
// under the License.
-use crate::raw::*;
-use crate::*;
-use bytes::Bytes;
use std::io::SeekFrom;
use std::sync::Arc;
-use std::task::{Context, Poll};
+use std::task::Context;
+use std::task::Poll;
+
+use bytes::Bytes;
+
+use crate::raw::*;
+use crate::*;
/// Convert given reader into a wrapper with `std::sync::Mutex` for `Send +
Sync + Clone`.
pub fn into_cloneable_reader_within_std<R>(reader: R) ->
CloneableReaderWithinStd<R> {
diff --git a/core/src/raw/oio/read/into_read_from_stream.rs
b/core/src/raw/oio/read/into_read_from_stream.rs
index 0a231de2b..9bb734eda 100644
--- a/core/src/raw/oio/read/into_read_from_stream.rs
+++ b/core/src/raw/oio/read/into_read_from_stream.rs
@@ -15,12 +15,16 @@
// specific language governing permissions and limitations
// under the License.
+use std::io::SeekFrom;
+use std::task::Context;
+use std::task::Poll;
+
+use bytes::Buf;
+use bytes::Bytes;
+use futures::StreamExt;
+
use crate::raw::*;
use crate::*;
-use bytes::{Buf, Bytes};
-use futures::StreamExt;
-use std::io::SeekFrom;
-use std::task::{Context, Poll};
/// Convert given stream `futures::Stream<Item = Result<Bytes>>` into
[`oio::Reader`].
pub fn into_read_from_stream<S>(stream: S) -> FromStreamReader<S> {
diff --git a/core/src/raw/oio/write/api.rs b/core/src/raw/oio/write/api.rs
index dfc8ef6ab..cebaffc70 100644
--- a/core/src/raw/oio/write/api.rs
+++ b/core/src/raw/oio/write/api.rs
@@ -19,7 +19,8 @@ use std::fmt::Display;
use std::fmt::Formatter;
use std::future::Future;
use std::pin::Pin;
-use std::task::{Context, Poll};
+use std::task::Context;
+use std::task::Poll;
use async_trait::async_trait;
use pin_project::pin_project;
diff --git a/core/src/raw/oio/write/append_object_write.rs
b/core/src/raw/oio/write/append_object_write.rs
index ca2ba8b46..b85d08bd9 100644
--- a/core/src/raw/oio/write/append_object_write.rs
+++ b/core/src/raw/oio/write/append_object_write.rs
@@ -15,9 +15,12 @@
// specific language governing permissions and limitations
// under the License.
+use std::task::ready;
+use std::task::Context;
+use std::task::Poll;
+
use async_trait::async_trait;
use futures::future::BoxFuture;
-use std::task::{ready, Context, Poll};
use crate::raw::*;
use crate::*;
diff --git a/core/src/raw/oio/write/compose_write.rs
b/core/src/raw/oio/write/compose_write.rs
index 2b56e7233..e651aa714 100644
--- a/core/src/raw/oio/write/compose_write.rs
+++ b/core/src/raw/oio/write/compose_write.rs
@@ -38,8 +38,10 @@
//! This module is used to provide some enums for the above code. We should
remove this module once
//! type_alias_impl_trait has been stabilized.
+use std::task::Context;
+use std::task::Poll;
+
use async_trait::async_trait;
-use std::task::{Context, Poll};
use crate::raw::*;
use crate::*;
diff --git a/core/src/raw/oio/write/exact_buf_write.rs
b/core/src/raw/oio/write/exact_buf_write.rs
index 5c700029b..1fb404653 100644
--- a/core/src/raw/oio/write/exact_buf_write.rs
+++ b/core/src/raw/oio/write/exact_buf_write.rs
@@ -16,10 +16,13 @@
// under the License.
use std::cmp::min;
-use std::task::{ready, Context, Poll};
+use std::task::ready;
+use std::task::Context;
+use std::task::Poll;
use async_trait::async_trait;
-use bytes::{Bytes, BytesMut};
+use bytes::Bytes;
+use bytes::BytesMut;
use crate::raw::oio::WriteBuf;
use crate::raw::*;
diff --git a/core/src/raw/oio/write/multipart_upload_write.rs
b/core/src/raw/oio/write/multipart_upload_write.rs
index ec23b210c..7124554ff 100644
--- a/core/src/raw/oio/write/multipart_upload_write.rs
+++ b/core/src/raw/oio/write/multipart_upload_write.rs
@@ -15,10 +15,13 @@
// specific language governing permissions and limitations
// under the License.
+use std::sync::Arc;
+use std::task::ready;
+use std::task::Context;
+use std::task::Poll;
+
use async_trait::async_trait;
use futures::future::BoxFuture;
-use std::sync::Arc;
-use std::task::{ready, Context, Poll};
use crate::raw::*;
use crate::*;
diff --git a/core/src/raw/oio/write/one_shot_write.rs
b/core/src/raw/oio/write/one_shot_write.rs
index 7d6429864..9f54de083 100644
--- a/core/src/raw/oio/write/one_shot_write.rs
+++ b/core/src/raw/oio/write/one_shot_write.rs
@@ -15,10 +15,13 @@
// specific language governing permissions and limitations
// under the License.
+use std::task::ready;
+use std::task::Context;
+use std::task::Poll;
+
use async_trait::async_trait;
use bytes::Bytes;
use futures::future::BoxFuture;
-use std::task::{ready, Context, Poll};
use crate::raw::*;
use crate::*;
diff --git a/core/src/raw/oio/write/range_write.rs
b/core/src/raw/oio/write/range_write.rs
index f01f7d40f..10314424c 100644
--- a/core/src/raw/oio/write/range_write.rs
+++ b/core/src/raw/oio/write/range_write.rs
@@ -15,10 +15,13 @@
// specific language governing permissions and limitations
// under the License.
+use std::task::ready;
+use std::task::Context;
+use std::task::Poll;
+
use async_trait::async_trait;
use futures::future::BoxFuture;
use futures::FutureExt;
-use std::task::{ready, Context, Poll};
use crate::raw::oio::WriteBuf;
use crate::raw::*;
diff --git a/core/src/services/fs/writer.rs b/core/src/services/fs/writer.rs
index 6964b4150..61361bdaf 100644
--- a/core/src/services/fs/writer.rs
+++ b/core/src/services/fs/writer.rs
@@ -18,7 +18,9 @@
use std::io::Write;
use std::path::PathBuf;
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::future::BoxFuture;
diff --git a/core/src/services/ftp/writer.rs b/core/src/services/ftp/writer.rs
index f7e8497d6..de4cbd116 100644
--- a/core/src/services/ftp/writer.rs
+++ b/core/src/services/ftp/writer.rs
@@ -15,11 +15,14 @@
// specific language governing permissions and limitations
// under the License.
+use std::task::ready;
+use std::task::Context;
+use std::task::Poll;
+
use async_trait::async_trait;
use futures::future::BoxFuture;
use futures::AsyncWriteExt;
use futures::FutureExt;
-use std::task::{ready, Context, Poll};
use super::backend::FtpBackend;
use crate::raw::*;
diff --git a/core/src/services/ghac/writer.rs b/core/src/services/ghac/writer.rs
index 09eb82d8f..a48f43283 100644
--- a/core/src/services/ghac/writer.rs
+++ b/core/src/services/ghac/writer.rs
@@ -15,9 +15,12 @@
// specific language governing permissions and limitations
// under the License.
+use std::task::ready;
+use std::task::Context;
+use std::task::Poll;
+
use async_trait::async_trait;
use futures::future::BoxFuture;
-use std::task::{ready, Context, Poll};
use super::backend::GhacBackend;
use super::error::parse_error;
diff --git a/core/src/services/hdfs/writer.rs b/core/src/services/hdfs/writer.rs
index 536b264ad..a436a8416 100644
--- a/core/src/services/hdfs/writer.rs
+++ b/core/src/services/hdfs/writer.rs
@@ -17,7 +17,8 @@
use std::io::Write;
use std::pin::Pin;
-use std::task::{Context, Poll};
+use std::task::Context;
+use std::task::Poll;
use async_trait::async_trait;
use futures::AsyncWrite;
diff --git a/core/src/services/obs/writer.rs b/core/src/services/obs/writer.rs
index 6b0aed175..62882b1ca 100644
--- a/core/src/services/obs/writer.rs
+++ b/core/src/services/obs/writer.rs
@@ -15,10 +15,10 @@
// specific language governing permissions and limitations
// under the License.
-use bytes::Bytes;
use std::sync::Arc;
use async_trait::async_trait;
+use bytes::Bytes;
use http::StatusCode;
use super::core::*;
diff --git a/core/src/services/sftp/writer.rs b/core/src/services/sftp/writer.rs
index e2faf80e2..3e596c4b4 100644
--- a/core/src/services/sftp/writer.rs
+++ b/core/src/services/sftp/writer.rs
@@ -15,11 +15,13 @@
// specific language governing permissions and limitations
// under the License.
+use std::pin::Pin;
+use std::task::Context;
+use std::task::Poll;
+
use async_trait::async_trait;
use openssh_sftp_client::file::File;
use openssh_sftp_client::file::TokioCompatFile;
-use std::pin::Pin;
-use std::task::{Context, Poll};
use tokio::io::AsyncWrite;
use crate::raw::oio;
diff --git a/core/src/types/operator/operator.rs
b/core/src/types/operator/operator.rs
index 1aa814658..771ffd677 100644
--- a/core/src/types/operator/operator.rs
+++ b/core/src/types/operator/operator.rs
@@ -17,7 +17,8 @@
use std::time::Duration;
-use bytes::{Buf, Bytes};
+use bytes::Buf;
+use bytes::Bytes;
use futures::stream;
use futures::AsyncReadExt;
use futures::Stream;
diff --git a/core/src/types/writer.rs b/core/src/types/writer.rs
index 961647a57..56e87c5fb 100644
--- a/core/src/types/writer.rs
+++ b/core/src/types/writer.rs
@@ -24,8 +24,9 @@ use bytes::Bytes;
use futures::AsyncWrite;
use futures::TryStreamExt;
+use crate::raw::oio::Write;
use crate::raw::oio::WriteBuf;
-use crate::raw::oio::{Write, WriteExt};
+use crate::raw::oio::WriteExt;
use crate::raw::*;
use crate::*;
diff --git a/core/tests/behavior/write.rs b/core/tests/behavior/write.rs
index 10c9e8c1a..60125243a 100644
--- a/core/tests/behavior/write.rs
+++ b/core/tests/behavior/write.rs
@@ -19,7 +19,8 @@ use std::str::FromStr;
use std::time::Duration;
use anyhow::Result;
-use bytes::{Buf, Bytes};
+use bytes::Buf;
+use bytes::Bytes;
use futures::io::BufReader;
use futures::io::Cursor;
use futures::stream;