Skip to content

Commit

Permalink
Make clippy happy
Browse files Browse the repository at this point in the history
Signed-off-by: Xuanwo <github@xuanwo.io>
  • Loading branch information
Xuanwo committed Mar 1, 2023
1 parent aeed7ec commit 3515430
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/object/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl AsyncWrite for ObjectWriter {
let bs = Bytes::from(buf.to_vec());
let size = bs.len();
let fut = async move {
let _ = w.append(bs).await?;
w.append(bs).await?;
Ok((size, w))
};
self.state = State::Write(Box::pin(fut));
Expand Down Expand Up @@ -145,7 +145,7 @@ impl AsyncWrite for ObjectWriter {
.take()
.expect("invalid state of writer: Idle state with empty write");
let fut = async move {
let _ = w.close().await?;
w.close().await?;
Ok(w)
};
self.state = State::Close(Box::pin(fut));
Expand Down
2 changes: 1 addition & 1 deletion src/services/azblob/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl output::Write for AzblobWriter {
&self.path,
Some(self.op.size()),
self.op.content_type(),
AsyncBody::Bytes(bs.into()),
AsyncBody::Bytes(bs),
)?;

self.backend
Expand Down
2 changes: 1 addition & 1 deletion src/services/azdfs/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl output::Write for AzdfsWriter {
let mut req = self.backend.azdfs_update_request(
&self.path,
Some(self.op.size()),
AsyncBody::Bytes(bs.into()),
AsyncBody::Bytes(bs),
)?;

self.backend
Expand Down
2 changes: 1 addition & 1 deletion src/services/fs/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ impl Accessor for FsBackend {
.create(true)
.truncate(true)
.write(true)
.open(&path)
.open(path)
.map_err(parse_io_error)?;

Ok((RpWrite::new(0), FsWriter::new(target_path, tmp_path, f)))
Expand Down
7 changes: 2 additions & 5 deletions src/services/fs/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ impl output::Write for FsWriter<tokio::fs::File> {
/// File could be partial written, so we will seek to start to make sure
/// we write the same content.
async fn write(&mut self, bs: Bytes) -> Result<()> {
self.f
.seek(SeekFrom::Start(0))
.await
.map_err(parse_io_error)?;
self.f.rewind().await.map_err(parse_io_error)?;
self.f.write_all(&bs).await.map_err(parse_io_error)?;

Ok(())
Expand Down Expand Up @@ -95,7 +92,7 @@ impl output::BlockingWrite for FsWriter<std::fs::File> {
/// File could be partial written, so we will seek to start to make sure
/// we write the same content.
fn write(&mut self, bs: Bytes) -> Result<()> {
self.f.seek(SeekFrom::Start(0)).map_err(parse_io_error)?;
self.f.rewind().map_err(parse_io_error)?;
self.f.write_all(&bs).map_err(parse_io_error)?;

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/services/gcs/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl output::Write for GcsWriter {
&self.path,
Some(self.op.size()),
self.op.content_type(),
AsyncBody::Bytes(bs.into()),
AsyncBody::Bytes(bs),
)?;

self.backend
Expand Down
2 changes: 1 addition & 1 deletion src/services/ghac/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl output::Write for GhacWriter {
let size = bs.len() as u64;
let req = self
.backend
.ghac_upload(self.cache_id, size, AsyncBody::Bytes(bs.into()))
.ghac_upload(self.cache_id, size, AsyncBody::Bytes(bs))
.await?;

let resp = self.backend.client.send_async(req).await?;
Expand Down
2 changes: 1 addition & 1 deletion src/services/hdfs/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl output::BlockingWrite for HdfsWriter<hdrs::File> {
/// File could be partial written, so we will seek to start to make sure
/// we write the same content.
fn write(&mut self, bs: Bytes) -> Result<()> {
self.f.seek(SeekFrom::Start(0)).map_err(parse_io_error)?;
self.f.rewind().map_err(parse_io_error)?;
self.f.write_all(&bs).map_err(parse_io_error)?;

Ok(())
Expand Down
5 changes: 1 addition & 4 deletions src/services/ipmfs/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ impl output::Write for IpmfsWriter {
async fn write(&mut self, bs: Bytes) -> Result<()> {
let resp = self
.backend
.ipmfs_write(
&self.path,
AsyncBody::Multipart("data".to_string(), bs.into()),
)
.ipmfs_write(&self.path, AsyncBody::Multipart("data".to_string(), bs))
.await?;

let status = resp.status();
Expand Down
2 changes: 1 addition & 1 deletion src/services/obs/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl output::Write for ObsWriter {
&self.path,
Some(self.op.size()),
self.op.content_type(),
AsyncBody::Bytes(bs.into()),
AsyncBody::Bytes(bs),
)?;

self.backend
Expand Down
2 changes: 1 addition & 1 deletion src/services/oss/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl output::Write for OssWriter {
Some(self.op.size()),
self.op.content_type(),
self.op.content_disposition(),
AsyncBody::Bytes(bs.into()),
AsyncBody::Bytes(bs),
false,
)?;

Expand Down
4 changes: 2 additions & 2 deletions src/services/s3/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl output::Write for S3Writer {
Some(self.op.size()),
self.op.content_type(),
self.op.content_disposition(),
AsyncBody::Bytes(bs.into()),
AsyncBody::Bytes(bs),
)?;

self.backend
Expand Down Expand Up @@ -89,7 +89,7 @@ impl output::Write for S3Writer {
upload_id,
part_number,
Some(bs.len() as u64),
AsyncBody::Bytes(bs.into()),
AsyncBody::Bytes(bs),
)?;

self.backend
Expand Down
2 changes: 1 addition & 1 deletion src/services/webdav/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl output::Write for WebdavWriter {
Some(self.op.size()),
self.op.content_type(),
self.op.content_disposition(),
AsyncBody::Bytes(bs.into()),
AsyncBody::Bytes(bs),
)
.await?;

Expand Down
2 changes: 1 addition & 1 deletion src/services/webhdfs/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl output::Write for WebhdfsWriter {
&self.path,
Some(self.op.size()),
self.op.content_type(),
AsyncBody::Bytes(bs.into()),
AsyncBody::Bytes(bs),
)
.await?;

Expand Down

0 comments on commit 3515430

Please sign in to comment.