You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2024/03/14 03:27:17 UTC
(opendal) 04/04: Fix clippy
This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch refactor-writer
in repository https://gitbox.apache.org/repos/asf/opendal.git
commit 1f99cc357bec386d4befbbbdfac276b5afebdaff
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Thu Mar 14 11:27:00 2024 +0800
Fix clippy
Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
core/src/raw/oio/write/api.rs | 2 +-
core/src/types/operator/blocking_operator.rs | 2 +-
core/src/types/operator/operator.rs | 2 +-
core/src/types/writer.rs | 6 +++---
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/core/src/raw/oio/write/api.rs b/core/src/raw/oio/write/api.rs
index 57242f5b56..a352d362bc 100644
--- a/core/src/raw/oio/write/api.rs
+++ b/core/src/raw/oio/write/api.rs
@@ -136,7 +136,7 @@ impl<T: Write> WriteExt for T {}
/// Extension of [`Read`] to make it easier for use.
pub trait WriteExt: Write {
/// Build a future for `poll_write`.
- fn write<'a>(&'a mut self, buf: Bytes) -> WriteFuture<'a, Self> {
+ fn write(&mut self, buf: Bytes) -> WriteFuture<'_, Self> {
WriteFuture { writer: self, buf }
}
diff --git a/core/src/types/operator/blocking_operator.rs b/core/src/types/operator/blocking_operator.rs
index 25bb734c95..eff9afb614 100644
--- a/core/src/types/operator/blocking_operator.rs
+++ b/core/src/types/operator/blocking_operator.rs
@@ -653,7 +653,7 @@ impl BlockingOperator {
}
let (_, mut w) = inner.blocking_write(&path, args)?;
- while bs.len() > 0 {
+ while !bs.is_empty() {
let n = w.write(bs.clone())?;
bs.advance(n);
}
diff --git a/core/src/types/operator/operator.rs b/core/src/types/operator/operator.rs
index c1ecb25778..3d62471aea 100644
--- a/core/src/types/operator/operator.rs
+++ b/core/src/types/operator/operator.rs
@@ -1269,7 +1269,7 @@ impl Operator {
}
let (_, mut w) = inner.write(&path, args).await?;
- while bs.len() > 0 {
+ while !bs.is_empty() {
let n = w.write(bs.clone()).await?;
bs.advance(n);
}
diff --git a/core/src/types/writer.rs b/core/src/types/writer.rs
index 1117d001de..d133f108c2 100644
--- a/core/src/types/writer.rs
+++ b/core/src/types/writer.rs
@@ -92,7 +92,7 @@ impl Writer {
/// Write into inner writer.
pub async fn write(&mut self, bs: impl Into<Bytes>) -> Result<()> {
let mut bs = bs.into();
- while bs.len() > 0 {
+ while !bs.is_empty() {
let n = self.inner.write(bs.clone()).await?;
bs.advance(n);
}
@@ -138,7 +138,7 @@ impl Writer {
let mut written = 0;
while let Some(bs) = sink_from.try_next().await? {
let mut bs = bs.into();
- while bs.len() > 0 {
+ while !bs.is_empty() {
let n = self.inner.write(bs.clone()).await?;
bs.advance(n);
written += n as u64;
@@ -277,7 +277,7 @@ impl BlockingWriter {
/// Write into inner writer.
pub fn write(&mut self, bs: impl Into<Bytes>) -> Result<()> {
let mut bs = bs.into();
- while bs.len() > 0 {
+ while !bs.is_empty() {
let n = self.inner.write(bs.clone())?;
bs.advance(n);
}