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 2023/04/06 13:06:13 UTC

[incubator-opendal] branch bump-msrv created (now 80420b75)

This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a change to branch bump-msrv
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git


      at 80420b75 refactor: Bump MSRV to 1.64

This branch includes the following new commits:

     new 80420b75 refactor: Bump MSRV to 1.64

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-opendal] 01/01: refactor: Bump MSRV to 1.64

Posted by xu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch bump-msrv
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git

commit 80420b75a364e5004a8846a05c00596ef2c210b4
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Thu Apr 6 21:05:40 2023 +0800

    refactor: Bump MSRV to 1.64
    
    Signed-off-by: Xuanwo <gi...@xuanwo.io>
---
 .github/workflows/ci.yml                  |  4 ++--
 Cargo.toml                                |  9 +++++++++
 bin/oli/Cargo.toml                        | 21 ++++++++++++++-------
 bin/oli/src/commands/cat.rs               |  7 +++++--
 bin/oli/src/commands/cp.rs                | 11 ++++++++---
 bin/oli/src/commands/ls.rs                |  8 ++++++--
 bin/oli/src/commands/rm.rs                |  8 ++++++--
 bin/oli/src/commands/stat.rs              |  7 +++++--
 bin/oli/src/config/mod.rs                 |  8 +++++---
 bindings/c/Cargo.toml                     | 12 +++++++-----
 bindings/java/Cargo.toml                  |  9 +++++++--
 bindings/java/src/lib.rs                  |  8 ++++----
 bindings/nodejs/Cargo.toml                | 14 ++++++++------
 bindings/object_store/Cargo.toml          | 15 ++++++++-------
 bindings/python/Cargo.toml                | 14 ++++++++------
 bindings/python/pyproject.toml            |  4 ++--
 bindings/ruby/Cargo.toml                  | 14 ++++++++------
 core/Cargo.toml                           | 17 +++++++++--------
 core/src/services/oss/backend.rs          |  2 +-
 core/src/services/s3/backend.rs           |  3 ++-
 core/src/services/webdav/backend.rs       | 10 +++++-----
 core/src/services/webdav/list_response.rs | 18 +++++++++++-------
 core/src/types/operator/operator.rs       |  4 +++-
 23 files changed, 143 insertions(+), 84 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f6c026e4..9cf59d55 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -103,8 +103,8 @@ jobs:
   check_msrv:
     runs-on: ubuntu-latest
     env:
-      # OpenDAL's MSRV is 1.60.
-      OPENDAL_MSRV: "1.60"
+      # OpenDAL's MSRV is 1.64.
+      OPENDAL_MSRV: "1.64"
     steps:
       - uses: actions/checkout@v3
       - name: Setup msrv of rust
diff --git a/Cargo.toml b/Cargo.toml
index 652ff8bd..cd8e3e95 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -31,3 +31,12 @@ members = [
 
   "bin/oli",
 ]
+
+[workspace.package]
+authors = ["OpenDAL Contributors <de...@opendal.apache.org>"]
+edition = "2021"
+homepage = "https://opendal.apache.org/"
+license = "Apache-2.0"
+repository = "https://github.com/apache/incubator-opendal"
+rust-version = "1.64"
+version = "0.30.5"
diff --git a/bin/oli/Cargo.toml b/bin/oli/Cargo.toml
index 4567442a..2d64deb5 100644
--- a/bin/oli/Cargo.toml
+++ b/bin/oli/Cargo.toml
@@ -16,16 +16,18 @@
 # under the License.
 
 [package]
-authors = ["OpenDAL Contributors <de...@opendal.apache.org>"]
 categories = ["filesystem"]
 description = "OpenDAL Command Line Interface"
-edition = "2021"
-homepage = "https://opendal.apache.org/"
 keywords = ["storage", "data", "s3", "fs", "azblob"]
-license = "Apache-2.0"
 name = "oli"
-repository = "https://github.com/apache/incubator-opendal"
-version = "0.30.5"
+
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+license.workspace = true
+repository.workspace = true
+rust-version.workspace = true
+version.workspace = true
 
 [features]
 # Enable services dashmap support
@@ -56,7 +58,12 @@ futures = "0.3"
 log = "0.4"
 opendal = { version = "0.30", path = "../../core" }
 serde = { version = "1", features = ["derive"] }
-tokio = { version = "1.27", features = ["fs", "macros", "rt-multi-thread", "io-std"] }
+tokio = { version = "1.27", features = [
+  "fs",
+  "macros",
+  "rt-multi-thread",
+  "io-std",
+] }
 toml = "0.7.3"
 url = "2.3.1"
 
diff --git a/bin/oli/src/commands/cat.rs b/bin/oli/src/commands/cat.rs
index 21c9120f..ff120384 100644
--- a/bin/oli/src/commands/cat.rs
+++ b/bin/oli/src/commands/cat.rs
@@ -17,8 +17,11 @@
 
 use std::path::PathBuf;
 
-use anyhow::{anyhow, Result};
-use clap::{Arg, ArgMatches, Command};
+use anyhow::anyhow;
+use anyhow::Result;
+use clap::Arg;
+use clap::ArgMatches;
+use clap::Command;
 use tokio::io;
 
 use crate::config::Config;
diff --git a/bin/oli/src/commands/cp.rs b/bin/oli/src/commands/cp.rs
index 90aa7403..0c446892 100644
--- a/bin/oli/src/commands/cp.rs
+++ b/bin/oli/src/commands/cp.rs
@@ -15,10 +15,15 @@
 // specific language governing permissions and limitations
 // under the License.
 
-use std::path::{Path, PathBuf};
+use std::path::Path;
+use std::path::PathBuf;
 
-use anyhow::{anyhow, Result};
-use clap::{Arg, ArgAction, ArgMatches, Command};
+use anyhow::anyhow;
+use anyhow::Result;
+use clap::Arg;
+use clap::ArgAction;
+use clap::ArgMatches;
+use clap::Command;
 use futures::TryStreamExt;
 use opendal::Metakey;
 
diff --git a/bin/oli/src/commands/ls.rs b/bin/oli/src/commands/ls.rs
index a2eff309..70747cff 100644
--- a/bin/oli/src/commands/ls.rs
+++ b/bin/oli/src/commands/ls.rs
@@ -17,8 +17,12 @@
 
 use std::path::PathBuf;
 
-use anyhow::{anyhow, Result};
-use clap::{Arg, ArgAction, ArgMatches, Command};
+use anyhow::anyhow;
+use anyhow::Result;
+use clap::Arg;
+use clap::ArgAction;
+use clap::ArgMatches;
+use clap::Command;
 use futures::TryStreamExt;
 
 use crate::config::Config;
diff --git a/bin/oli/src/commands/rm.rs b/bin/oli/src/commands/rm.rs
index 32ff961b..87fbe913 100644
--- a/bin/oli/src/commands/rm.rs
+++ b/bin/oli/src/commands/rm.rs
@@ -17,8 +17,12 @@
 
 use std::path::PathBuf;
 
-use anyhow::{anyhow, Result};
-use clap::{Arg, ArgAction, ArgMatches, Command};
+use anyhow::anyhow;
+use anyhow::Result;
+use clap::Arg;
+use clap::ArgAction;
+use clap::ArgMatches;
+use clap::Command;
 
 use crate::config::Config;
 
diff --git a/bin/oli/src/commands/stat.rs b/bin/oli/src/commands/stat.rs
index 1873b1a8..8d754531 100644
--- a/bin/oli/src/commands/stat.rs
+++ b/bin/oli/src/commands/stat.rs
@@ -17,8 +17,11 @@
 
 use std::path::PathBuf;
 
-use anyhow::{anyhow, Result};
-use clap::{Arg, ArgMatches, Command};
+use anyhow::anyhow;
+use anyhow::Result;
+use clap::Arg;
+use clap::ArgMatches;
+use clap::Command;
 
 use crate::config::Config;
 
diff --git a/bin/oli/src/config/mod.rs b/bin/oli/src/config/mod.rs
index 8cf0bcae..d9e30cd9 100644
--- a/bin/oli/src/config/mod.rs
+++ b/bin/oli/src/config/mod.rs
@@ -19,7 +19,9 @@ use std::borrow::Cow;
 use std::collections::HashMap;
 use std::env;
 use std::fs;
-use std::path::{Component, Path, PathBuf};
+use std::path::Component;
+use std::path::Path;
+use std::path::PathBuf;
 use std::str::FromStr;
 
 use anyhow::anyhow;
@@ -76,7 +78,7 @@ impl Config {
         let profiles = Config::load_from_env().profiles.into_iter().fold(
             cfg.profiles,
             |mut acc, (name, opts)| {
-                acc.entry(name).or_insert(HashMap::new()).extend(opts);
+                acc.entry(name).or_insert_with(HashMap::new).extend(opts);
                 acc
             },
         );
@@ -114,7 +116,7 @@ impl Config {
             })
             .fold(HashMap::new(), |mut acc, (profile_name, key, val)| {
                 acc.entry(profile_name)
-                    .or_insert(HashMap::new())
+                    .or_insert_with(HashMap::new)
                     .insert(key, val);
                 acc
             });
diff --git a/bindings/c/Cargo.toml b/bindings/c/Cargo.toml
index d5e30e87..9d39b43e 100644
--- a/bindings/c/Cargo.toml
+++ b/bindings/c/Cargo.toml
@@ -16,15 +16,17 @@
 # under the License.
 
 [package]
-authors = ["OpenDAL Contributors <de...@opendal.apache.org>"]
-edition = "2021"
-homepage = "https://opendal.apache.org/"
-license = "Apache-2.0"
 name = "opendal-c"
 publish = false
-repository = "https://github.com/apache/incubator-opendal"
 version = "0.1.0"
 
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+license.workspace = true
+repository.workspace = true
+rust-version.workspace = true
+
 [lib]
 crate-type = ["cdylib"]
 doc = false
diff --git a/bindings/java/Cargo.toml b/bindings/java/Cargo.toml
index 84487340..66b0a5b8 100644
--- a/bindings/java/Cargo.toml
+++ b/bindings/java/Cargo.toml
@@ -17,15 +17,20 @@
 
 [package]
 name = "opendal-java"
+publish = false
 version = "0.1.0"
-edition = "2021"
 
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+license.workspace = true
+repository.workspace = true
+rust-version.workspace = true
 
 [lib]
 crate-type = ["cdylib"]
 doc = false
 
-
 [dependencies]
 jni = "0.21.1"
 opendal = { version = "0.30", path = "../../core" }
diff --git a/bindings/java/src/lib.rs b/bindings/java/src/lib.rs
index 323f485a..1ee69a23 100644
--- a/bindings/java/src/lib.rs
+++ b/bindings/java/src/lib.rs
@@ -88,7 +88,7 @@ pub unsafe extern "system" fn Java_org_apache_opendal_Operator_freeOperator(
     _class: JClass,
     ptr: *mut Operator,
 ) {
-    unsafe { Box::from_raw(ptr) };
+    let _ = Box::from_raw(ptr);
 }
 
 /// # Safety
@@ -102,7 +102,7 @@ pub unsafe extern "system" fn Java_org_apache_opendal_Operator_write(
     file: JString,
     content: JString,
 ) {
-    let op = unsafe { &mut *ptr };
+    let op = &mut *ptr;
     let file: String = env
         .get_string(&file)
         .expect("Couldn't get java string!")
@@ -124,7 +124,7 @@ pub unsafe extern "system" fn Java_org_apache_opendal_Operator_read<'local>(
     ptr: *mut BlockingOperator,
     file: JString<'local>,
 ) -> JString<'local> {
-    let op = unsafe { &mut *ptr };
+    let op = &mut *ptr;
     let file: String = env
         .get_string(&file)
         .expect("Couldn't get java string!")
@@ -147,7 +147,7 @@ pub unsafe extern "system" fn Java_org_apache_opendal_Operator_delete<'local>(
     ptr: *mut BlockingOperator,
     file: JString<'local>,
 ) {
-    let op = unsafe { &mut *ptr };
+    let op = &mut *ptr;
     let file: String = env
         .get_string(&file)
         .expect("Couldn't get java string!")
diff --git a/bindings/nodejs/Cargo.toml b/bindings/nodejs/Cargo.toml
index 4dc319cf..8f1f287a 100644
--- a/bindings/nodejs/Cargo.toml
+++ b/bindings/nodejs/Cargo.toml
@@ -16,14 +16,16 @@
 # under the License.
 
 [package]
-authors = ["OpenDAL Contributors <de...@opendal.apache.org>"]
-edition = "2021"
-homepage = "https://opendal.apache.org/"
-license = "Apache-2.0"
 name = "opendal-nodejs"
 publish = false
-repository = "https://github.com/apache/incubator-opendal"
-version = "0.30.5"
+
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+license.workspace = true
+repository.workspace = true
+rust-version.workspace = true
+version.workspace = true
 
 [lib]
 crate-type = ["cdylib"]
diff --git a/bindings/object_store/Cargo.toml b/bindings/object_store/Cargo.toml
index 3e87444d..30618e03 100644
--- a/bindings/object_store/Cargo.toml
+++ b/bindings/object_store/Cargo.toml
@@ -16,15 +16,16 @@
 # under the License.
 
 [package]
-authors = ["OpenDAL Contributors <de...@opendal.apache.org>"]
 description = "OpenDAL's object_store binding"
-edition = "2021"
-homepage = "https://opendal.apache.org/"
-license = "Apache-2.0"
 name = "object_store_opendal"
-repository = "https://github.com/apache/incubator-opendal"
-rust-version = "1.60"                                       # MSRV for this project - please update while bump versions
-version = "0.30.5"
+
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+license.workspace = true
+repository.workspace = true
+rust-version.workspace = true
+version.workspace = true
 
 [dependencies]
 async-trait = "0.1"
diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml
index 6a06f2ac..4b147cd9 100644
--- a/bindings/python/Cargo.toml
+++ b/bindings/python/Cargo.toml
@@ -16,14 +16,16 @@
 # under the License.
 
 [package]
-authors = ["OpenDAL Contributors <de...@opendal.apache.org>"]
-edition = "2021"
-homepage = "https://opendal.apache.org/"
-license = "Apache-2.0"
 name = "opendal-python"
 publish = false
-repository = "https://github.com/apache/incubator-opendal"
-version = "0.30.5"
+
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+license.workspace = true
+repository.workspace = true
+rust-version.workspace = true
+version.workspace = true
 
 [lib]
 crate-type = ["cdylib"]
diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml
index b68eff1b..651a3838 100644
--- a/bindings/python/pyproject.toml
+++ b/bindings/python/pyproject.toml
@@ -32,8 +32,8 @@ readme = "README.md"
 requires-python = ">=3.7"
 
 [project.optional-dependencies]
-test = ["behave"]
 docs = ["pdoc"]
+test = ["behave"]
 
 [project.urls]
 Documentation = "https://docs.rs/opendal/"
@@ -41,6 +41,6 @@ Homepage = "https://opendal.apache.org/"
 Repository = "https://github.com/apache/incubator-opendal"
 
 [tool.maturin]
-module-name = "opendal._opendal"
 features = ["pyo3/extension-module"]
+module-name = "opendal._opendal"
 python-source = "python"
diff --git a/bindings/ruby/Cargo.toml b/bindings/ruby/Cargo.toml
index 55d2d79c..5058e957 100644
--- a/bindings/ruby/Cargo.toml
+++ b/bindings/ruby/Cargo.toml
@@ -16,20 +16,22 @@
 # under the License.
 
 [package]
-authors = ["OpenDAL Contributors <de...@opendal.apache.org>"]
-edition = "2021"
-homepage = "https://opendal.apache.org/"
-license = "Apache-2.0"
 name = "opendal-ruby"
 publish = false
-repository = "https://github.com/apache/incubator-opendal"
 version = "0.1.0"
 
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+license.workspace = true
+repository.workspace = true
+rust-version.workspace = true
+
 [lib]
 crate-type = ["cdylib"]
 doc = false
 name = "opendal_ruby"
 
 [dependencies]
+magnus = { version = "0.5", features = ["bytes-crate"] }
 opendal = { version = "0.30", path = "../../core" }
-magnus = { version = "0.5" , features = ["bytes-crate"] }
diff --git a/core/Cargo.toml b/core/Cargo.toml
index 98b97ca8..17b49a54 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -16,18 +16,19 @@
 # under the License.
 
 [package]
-authors = ["OpenDAL Contributors <de...@opendal.apache.org>"]
 categories = ["filesystem"]
 description = "OpenDAL: Access data freely, painlessly, and efficiently."
-edition = "2021"
 exclude = ["tests/"]
-homepage = "https://opendal.apache.org/"
 keywords = ["storage", "fs", "s3", "azblob", "gcs"]
-license = "Apache-2.0"
 name = "opendal"
-repository = "https://github.com/apache/incubator-opendal"
-rust-version = "1.60"                                                     # MSRV for this project - please update while bump versions
-version = "0.30.5"
+
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+license.workspace = true
+repository.workspace = true
+rust-version.workspace = true
+version.workspace = true
 
 [package.metadata.docs.rs]
 all-features = true
@@ -121,7 +122,7 @@ reqsign = "0.8.5"
 reqwest = { version = "0.11.13", features = [
   "multipart",
   "stream",
-  "blocking"
+  "blocking",
 ], default-features = false }
 rocksdb = { version = "0.20.1", default-features = false, optional = true }
 serde = { version = "1", features = ["derive"] }
diff --git a/core/src/services/oss/backend.rs b/core/src/services/oss/backend.rs
index dcd0a5b2..a1bfeacf 100644
--- a/core/src/services/oss/backend.rs
+++ b/core/src/services/oss/backend.rs
@@ -1108,7 +1108,7 @@ mod tests {
         <ETag>"8C315065167132444177411FDA14****"</ETag>
     </Part>
 </CompleteMultipartUpload>"#
-                .replace('"', "&quot;") // Escape `"` by hand to address <https://github.com/tafia/quick-xml/issues/362>
+                .replace('"', "&quot;") /* Escape `"` by hand to address <https://github.com/tafia/quick-xml/issues/362> */
         )
     }
 
diff --git a/core/src/services/s3/backend.rs b/core/src/services/s3/backend.rs
index 27c09daf..d27f0049 100644
--- a/core/src/services/s3/backend.rs
+++ b/core/src/services/s3/backend.rs
@@ -26,10 +26,11 @@ use base64::prelude::BASE64_STANDARD;
 use base64::Engine;
 use bytes::Buf;
 use bytes::Bytes;
+use http::header::HeaderName;
+use http::header::CACHE_CONTROL;
 use http::header::CONTENT_DISPOSITION;
 use http::header::CONTENT_LENGTH;
 use http::header::CONTENT_TYPE;
-use http::header::{HeaderName, CACHE_CONTROL};
 use http::HeaderValue;
 use http::Request;
 use http::Response;
diff --git a/core/src/services/webdav/backend.rs b/core/src/services/webdav/backend.rs
index 0f539ed9..5b1180c5 100644
--- a/core/src/services/webdav/backend.rs
+++ b/core/src/services/webdav/backend.rs
@@ -21,20 +21,20 @@ use std::fmt::Formatter;
 
 use async_trait::async_trait;
 use bytes::Buf;
+use http::header;
+use http::HeaderMap;
 use http::Request;
 use http::Response;
 use http::StatusCode;
-use http::{header, HeaderMap};
 use log::debug;
 
-use crate::ops::*;
-use crate::raw::*;
-use crate::*;
-
 use super::error::parse_error;
 use super::list_response::Multistatus;
 use super::pager::WebdavPager;
 use super::writer::WebdavWriter;
+use crate::ops::*;
+use crate::raw::*;
+use crate::*;
 
 /// [WebDAV](https://datatracker.ietf.org/doc/html/rfc4918) backend support.
 ///
diff --git a/core/src/services/webdav/list_response.rs b/core/src/services/webdav/list_response.rs
index b12b5c05..12e34586 100644
--- a/core/src/services/webdav/list_response.rs
+++ b/core/src/services/webdav/list_response.rs
@@ -19,14 +19,18 @@ use serde::Deserialize;
 use time::format_description::well_known::Rfc2822;
 use time::OffsetDateTime;
 
-use crate::{EntryMode, Error, ErrorKind, Metadata, Result};
+use crate::EntryMode;
+use crate::Error;
+use crate::ErrorKind;
+use crate::Metadata;
+use crate::Result;
 
-#[derive(Deserialize, Debug, PartialEq)]
+#[derive(Deserialize, Debug, PartialEq, Eq)]
 pub struct Multistatus {
     pub response: Vec<ListOpResponse>,
 }
 
-#[derive(Deserialize, Debug, PartialEq)]
+#[derive(Deserialize, Debug, PartialEq, Eq)]
 pub struct ListOpResponse {
     pub href: String,
     pub propstat: Propstat,
@@ -84,13 +88,13 @@ impl ListOpResponse {
     }
 }
 
-#[derive(Deserialize, Debug, PartialEq)]
+#[derive(Deserialize, Debug, PartialEq, Eq)]
 pub struct Propstat {
     pub prop: Prop,
     pub status: String,
 }
 
-#[derive(Deserialize, Debug, PartialEq)]
+#[derive(Deserialize, Debug, PartialEq, Eq)]
 pub struct Prop {
     #[serde(default)]
     pub displayname: String,
@@ -101,13 +105,13 @@ pub struct Prop {
     pub resourcetype: ResourceTypeContainer,
 }
 
-#[derive(Deserialize, Debug, PartialEq)]
+#[derive(Deserialize, Debug, PartialEq, Eq)]
 pub struct ResourceTypeContainer {
     #[serde(rename = "$value")]
     pub value: Option<ResourceType>,
 }
 
-#[derive(Deserialize, Debug, PartialEq)]
+#[derive(Deserialize, Debug, PartialEq, Eq)]
 #[serde(rename_all = "lowercase")]
 pub enum ResourceType {
     Collection,
diff --git a/core/src/types/operator/operator.rs b/core/src/types/operator/operator.rs
index 5ced9db3..67afac85 100644
--- a/core/src/types/operator/operator.rs
+++ b/core/src/types/operator/operator.rs
@@ -500,7 +500,9 @@ impl Operator {
     /// # use opendal::ops::OpRead;
     /// # #[tokio::main]
     /// # async fn test(op: Operator) -> Result<()> {
-    /// let r = op.reader_with("path/to/file", OpRead::default().with_range((0..10).into())).await?;
+    /// let r = op
+    ///     .reader_with("path/to/file", OpRead::default().with_range((0..10).into()))
+    ///     .await?;
     /// # Ok(())
     /// # }
     /// ```