From 7dfe639c83fd232be1b40f69a08c9e18b5cc6695 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Fri, 26 Jul 2024 12:49:59 +0800 Subject: [PATCH] chore: Make rust 1.80 clippy happy Signed-off-by: Xuanwo --- .github/workflows/docs.yml | 16 ++++++++-------- core/Cargo.toml | 1 - core/src/layers/blocking.rs | 2 +- core/src/lib.rs | 4 ++-- core/src/raw/oio/write/multipart_write.rs | 2 +- core/src/services/fs/backend.rs | 2 +- core/src/services/gdrive/builder.rs | 2 +- core/src/services/github/core.rs | 2 +- core/src/services/hdfs/backend.rs | 2 +- core/src/services/s3/backend.rs | 17 ++++++++--------- core/src/types/read/buffer_stream.rs | 2 +- 11 files changed, 25 insertions(+), 27 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d3430e492a1..fbf561af63c 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -22,7 +22,7 @@ on: branches: - main tags: - - 'v*' + - "v*" pull_request: branches: - main @@ -40,8 +40,8 @@ concurrency: env: # This same toolchain for rust 1.79.0 but nightly so we can use new features. RUST_DOC_TOOLCHAIN: nightly-2024-06-13 - # Enable cfg docs to make sure docs are built. - RUSTDOCFLAGS: "--cfg docs" + # Enable cfg docsrs to make sure docs are built. + RUSTDOCFLAGS: "--cfg docsrs" jobs: build-rust-doc: @@ -64,7 +64,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: temurin - java-version: '17' + java-version: "17" - name: Build OpenDAL doc working-directory: core @@ -87,7 +87,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: temurin - java-version: '17' + java-version: "17" - name: Build and test working-directory: bindings/java @@ -111,7 +111,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: '18' + node-version: "18" cache: pnpm cache-dependency-path: "bindings/nodejs/pnpm-lock.yaml" - name: Corepack @@ -144,7 +144,7 @@ jobs: - uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: "3.11" - name: Setup Rust toolchain uses: ./.github/actions/setup @@ -435,7 +435,7 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: '18' + node-version: "18" cache: pnpm cache-dependency-path: "website/pnpm-lock.yaml" diff --git a/core/Cargo.toml b/core/Cargo.toml index fdd8a3f4dee..e5bffed1ebe 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -32,7 +32,6 @@ version = "0.47.3" [package.metadata.docs.rs] all-features = true -rustdoc-args = ["--cfg", "docs"] [workspace] default-members = ["."] diff --git a/core/src/layers/blocking.rs b/core/src/layers/blocking.rs index 902adff5695..3b592a53068 100644 --- a/core/src/layers/blocking.rs +++ b/core/src/layers/blocking.rs @@ -95,7 +95,7 @@ use crate::*; /// In a pure blocking context, we can create a runtime and use it to create the `BlockingLayer`. /// /// > The following code uses a global statically created runtime as an example, please manage the -/// runtime on demand. +/// > runtime on demand. /// /// ```rust,no_run /// use once_cell::sync::Lazy; diff --git a/core/src/lib.rs b/core/src/lib.rs index dbcde72e67f..c8f8d48ec76 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -18,7 +18,7 @@ #![doc( html_logo_url = "https://raw.githubusercontent.com/apache/opendal/main/website/static/img/logo.svg" )] -#![cfg_attr(docs, feature(doc_auto_cfg))] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] //! Apache OpenDALâ„¢ is a data access layer that allows users to easily and //! efficiently retrieve data from various storage services in a unified way. @@ -132,7 +132,7 @@ mod types; pub use types::*; // Public modules, they will be accessed like `opendal::layers::Xxxx` -#[cfg(docs)] +#[cfg(docsrs)] pub mod docs; pub mod layers; pub mod raw; diff --git a/core/src/raw/oio/write/multipart_write.rs b/core/src/raw/oio/write/multipart_write.rs index e5c99001247..2ce71ef4fe7 100644 --- a/core/src/raw/oio/write/multipart_write.rs +++ b/core/src/raw/oio/write/multipart_write.rs @@ -69,7 +69,7 @@ pub trait MultipartWrite: Send + Sync + Unpin + 'static { /// /// - the total size of data is unknown. /// - the total size of data is known, but the size of current write - /// is less then the total size. + /// is less then the total size. fn initiate_part(&self) -> impl Future> + MaybeSend; /// write_part will write a part of the data and returns the result diff --git a/core/src/services/fs/backend.rs b/core/src/services/fs/backend.rs index dd1ec77b9e0..0559fa7c578 100644 --- a/core/src/services/fs/backend.rs +++ b/core/src/services/fs/backend.rs @@ -73,7 +73,7 @@ impl FsBuilder { /// # Notes /// /// - When append is enabled, we will not use atomic write - /// to avoid data loss and performance issue. + /// to avoid data loss and performance issue. pub fn atomic_write_dir(mut self, dir: &str) -> Self { if !dir.is_empty() { self.config.atomic_write_dir = Some(dir.to_string()); diff --git a/core/src/services/gdrive/builder.rs b/core/src/services/gdrive/builder.rs index ab801c70f15..07e1128e66f 100644 --- a/core/src/services/gdrive/builder.rs +++ b/core/src/services/gdrive/builder.rs @@ -104,7 +104,7 @@ impl GdriveBuilder { /// /// - An access token is valid for 1 hour. /// - If you want to use the access token for a long time, - /// you can use the refresh token to get a new access token. + /// you can use the refresh token to get a new access token. pub fn access_token(mut self, access_token: &str) -> Self { self.config.access_token = Some(access_token.to_string()); self diff --git a/core/src/services/github/core.rs b/core/src/services/github/core.rs index d8850915d85..c68dc3b2e4f 100644 --- a/core/src/services/github/core.rs +++ b/core/src/services/github/core.rs @@ -169,7 +169,7 @@ impl GithubCore { let mut req_body = CreateOrUpdateContentsRequest { message: format!("Write {} at {} via opendal", path, chrono::Local::now()), - content: base64::engine::general_purpose::STANDARD.encode(&bs.to_bytes()), + content: base64::engine::general_purpose::STANDARD.encode(bs.to_bytes()), sha: None, }; diff --git a/core/src/services/hdfs/backend.rs b/core/src/services/hdfs/backend.rs index 50b1dbbc323..857bd6a710b 100644 --- a/core/src/services/hdfs/backend.rs +++ b/core/src/services/hdfs/backend.rs @@ -151,7 +151,7 @@ impl HdfsBuilder { /// # Notes /// /// - When append is enabled, we will not use atomic write - /// to avoid data loss and performance issue. + /// to avoid data loss and performance issue. pub fn atomic_write_dir(mut self, dir: &str) -> Self { self.config.atomic_write_dir = if dir.is_empty() { None diff --git a/core/src/services/s3/backend.rs b/core/src/services/s3/backend.rs index 0feee28a7ea..296eff9c734 100644 --- a/core/src/services/s3/backend.rs +++ b/core/src/services/s3/backend.rs @@ -147,13 +147,13 @@ pub struct S3Config { /// server_side_encryption_aws_kms_key_id for this backend /// /// - If `server_side_encryption` set to `aws:kms`, and `server_side_encryption_aws_kms_key_id` - /// is not set, S3 will use aws managed kms key to encrypt data. + /// is not set, S3 will use aws managed kms key to encrypt data. /// - If `server_side_encryption` set to `aws:kms`, and `server_side_encryption_aws_kms_key_id` - /// is a valid kms key id, S3 will use the provided kms key to encrypt data. + /// is a valid kms key id, S3 will use the provided kms key to encrypt data. /// - If the `server_side_encryption_aws_kms_key_id` is invalid or not found, an error will be - /// returned. + /// returned. /// - If `server_side_encryption` is not `aws:kms`, setting `server_side_encryption_aws_kms_key_id` - /// is a noop. + /// is a noop. pub server_side_encryption_aws_kms_key_id: Option, /// server_side_encryption_customer_algorithm for this backend. /// @@ -398,13 +398,12 @@ impl S3Builder { /// Set server_side_encryption_aws_kms_key_id for this backend /// /// - If `server_side_encryption` set to `aws:kms`, and `server_side_encryption_aws_kms_key_id` - /// is not set, S3 will use aws managed kms key to encrypt data. + /// is not set, S3 will use aws managed kms key to encrypt data. /// - If `server_side_encryption` set to `aws:kms`, and `server_side_encryption_aws_kms_key_id` - /// is a valid kms key id, S3 will use the provided kms key to encrypt data. + /// is a valid kms key id, S3 will use the provided kms key to encrypt data. /// - If the `server_side_encryption_aws_kms_key_id` is invalid or not found, an error will be - /// returned. - /// - If `server_side_encryption` is not `aws:kms`, setting `server_side_encryption_aws_kms_key_id` - /// is a noop. + /// returned. + /// - If `server_side_encryption` is not `aws:kms`, setting `server_side_encryption_aws_kms_key_id` is a noop. /// /// # Note /// diff --git a/core/src/types/read/buffer_stream.rs b/core/src/types/read/buffer_stream.rs index 9d5550e592a..1464ef6164a 100644 --- a/core/src/types/read/buffer_stream.rs +++ b/core/src/types/read/buffer_stream.rs @@ -132,7 +132,7 @@ impl oio::Read for ChunkedReader { /// The underlying reader is either a StreamingReader or a ChunkedReader. /// /// - If chunk is None, BufferStream will use StreamingReader to iterate -/// data in streaming way. +/// data in streaming way. /// - Otherwise, BufferStream will use ChunkedReader to read data in chunks. pub struct BufferStream { state: State,