This is an automated email from the ASF dual-hosted git repository.
Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 5d84f2b34 chore: MSRV 1.91 (#7849)
5d84f2b34 is described below
commit 5d84f2b34261d38f6c59254fc9e561f5941fb6ee
Author: tison <[email protected]>
AuthorDate: Sat Jul 4 01:15:48 2026 +0800
chore: MSRV 1.91 (#7849)
* chore: MSRV 1.91
Signed-off-by: tison <[email protected]>
* fixup names
Signed-off-by: tison <[email protected]>
* chore: satisfy collapsible-if clippy lint
---------
Signed-off-by: tison <[email protected]>
Co-authored-by: Xuanwo <[email protected]>
---
.github/workflows/ci_core.yml | 4 +-
.github/workflows/release_java.yml | 2 +-
AGENTS.md | 2 +-
CONTRIBUTING.md | 2 +-
bindings/c/Cargo.toml | 2 +-
bindings/cpp/Cargo.toml | 2 +-
bindings/dotnet/Cargo.toml | 2 +-
bindings/haskell/Cargo.toml | 2 +-
bindings/haskell/src/lib.rs | 17 +-
bindings/java/Cargo.toml | 2 +-
bindings/lua/Cargo.toml | 2 +-
bindings/nodejs/Cargo.toml | 2 +-
bindings/ocaml/Cargo.toml | 2 +-
bindings/php/Cargo.toml | 2 +-
bindings/python/Cargo.toml | 2 +-
bindings/ruby/Cargo.toml | 2 +-
bindings/ruby/opendal.gemspec | 2 +-
core/Cargo.lock | 200 ++++-----------------
core/Cargo.toml | 4 +-
core/core/src/layers/correctness_check.rs | 16 +-
core/core/src/raw/oio/copy/api.rs | 8 +-
core/core/src/services/memory/config.rs | 8 +-
core/core/src/types/context/read.rs | 8 +-
core/core/src/types/context/write.rs | 4 +-
.../src/main.rs | 4 +-
core/layers/fastrace/Cargo.toml | 2 +-
core/layers/immutable-index/src/lib.rs | 4 +-
core/layers/retry/src/lib.rs | 4 +-
core/layers/route/src/lib.rs | 16 +-
core/services/alluxio/src/config.rs | 8 +-
core/services/azblob/src/core.rs | 21 ++-
core/services/azdls/src/core.rs | 8 +-
core/services/b2/src/lister.rs | 8 +-
core/services/cacache/src/config.rs | 10 +-
core/services/cloudflare-kv/src/backend.rs | 72 ++++----
core/services/cloudflare-kv/src/config.rs | 8 +-
core/services/cloudflare-kv/src/core.rs | 8 +-
core/services/cloudflare-kv/src/reader.rs | 50 +++---
core/services/compfs/src/backend.rs | 18 +-
core/services/compfs/src/config.rs | 8 +-
core/services/cos/src/backend.rs | 8 +-
core/services/cos/src/writer.rs | 8 +-
core/services/d1/src/config.rs | 8 +-
core/services/dashmap/src/config.rs | 8 +-
core/services/dbfs/src/config.rs | 8 +-
core/services/dropbox/src/config.rs | 8 +-
core/services/etcd/src/config.rs | 8 +-
core/services/foundationdb/src/config.rs | 10 +-
core/services/foyer/src/config.rs | 8 +-
core/services/fs/src/backend.rs | 39 ++--
core/services/fs/src/core.rs | 19 +-
core/services/gcs/src/backend.rs | 24 +--
core/services/gdrive/src/config.rs | 8 +-
core/services/gdrive/src/core.rs | 13 +-
core/services/github/src/config.rs | 8 +-
core/services/goosefs/src/config.rs | 8 +-
core/services/goosefs/src/core.rs | 16 +-
core/services/gridfs/src/config.rs | 40 ++---
core/services/hdfs-native/src/config.rs | 8 +-
core/services/hdfs/src/backend.rs | 21 ++-
core/services/hdfs/src/config.rs | 8 +-
core/services/hf/src/backend.rs | 40 ++---
core/services/hf/src/config.rs | 20 +--
core/services/hf/src/core.rs | 8 +-
core/services/hf/src/lister.rs | 8 +-
core/services/ipfs/src/config.rs | 8 +-
core/services/ipmfs/src/config.rs | 8 +-
core/services/koofr/src/config.rs | 8 +-
core/services/lakefs/src/config.rs | 8 +-
core/services/lakefs/src/lister.rs | 8 +-
core/services/memcached/src/config.rs | 8 +-
core/services/mini_moka/src/config.rs | 8 +-
core/services/mongodb/src/config.rs | 40 ++---
core/services/monoiofs/src/backend.rs | 18 +-
core/services/monoiofs/src/config.rs | 8 +-
core/services/mysql/src/config.rs | 34 ++--
core/services/onedrive/src/config.rs | 18 +-
core/services/pcloud/src/config.rs | 8 +-
core/services/pcloud/src/core.rs | 11 +-
core/services/persy/src/config.rs | 10 +-
core/services/postgresql/src/config.rs | 34 ++--
core/services/redb/src/config.rs | 10 +-
core/services/redis/src/config.rs | 36 ++--
core/services/rocksdb/src/config.rs | 10 +-
core/services/seafile/src/config.rs | 8 +-
core/services/sftp/src/core.rs | 8 +-
core/services/sled/src/config.rs | 10 +-
core/services/sqlite/src/config.rs | 34 ++--
core/services/surrealdb/src/config.rs | 52 +++---
core/services/tikv/src/config.rs | 8 +-
core/services/tos/src/core.rs | 10 +-
core/services/vercel-blob/src/config.rs | 8 +-
core/services/webdav/src/core.rs | 30 ++--
core/services/webhdfs/src/config.rs | 8 +-
core/services/yandex-disk/src/config.rs | 8 +-
core/tests/behavior/main.rs | 4 +-
dev/Cargo.toml | 2 +-
dev/src/generate/parser.rs | 25 ++-
integrations/dav-server/Cargo.toml | 2 +-
integrations/object_store/Cargo.toml | 2 +-
integrations/parquet/Cargo.toml | 2 +-
integrations/unftp-sbe/Cargo.toml | 2 +-
102 files changed, 640 insertions(+), 786 deletions(-)
diff --git a/.github/workflows/ci_core.yml b/.github/workflows/ci_core.yml
index 87d1d6193..9692601e6 100644
--- a/.github/workflows/ci_core.yml
+++ b/.github/workflows/ci_core.yml
@@ -80,8 +80,8 @@ jobs:
check_msrv:
runs-on: ubuntu-latest
env:
- # OpenDAL's MSRV is 1.85.
- OPENDAL_MSRV: "1.85"
+ # OpenDAL's MSRV is 1.91.
+ OPENDAL_MSRV: "1.91"
steps:
- uses: actions/checkout@v7
- name: Setup msrv of rust
diff --git a/.github/workflows/release_java.yml
b/.github/workflows/release_java.yml
index 440d753c4..88edf62b3 100644
--- a/.github/workflows/release_java.yml
+++ b/.github/workflows/release_java.yml
@@ -98,7 +98,7 @@ jobs:
-e HOST_GID="$HOST_GID" \
-v "$GITHUB_WORKSPACE":/work \
-w /work/bindings/java \
- rust:1.85-alpine3.20 \
+ rust:1.91-alpine3.20 \
sh -lc '
set -eu
apk add --no-cache python3 build-base cmake pkgconfig git
protobuf sqlite-dev zlib-dev
diff --git a/AGENTS.md b/AGENTS.md
index c3b1d3984..4ba0201a4 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -131,7 +131,7 @@ When adding or changing a public optional layer:
## Important Notes
-- Minimum Rust version is 1.85, configured in `core/Cargo.toml` and checked by
CI.
+- Minimum Rust version is 1.91, configured in `core/Cargo.toml` and checked by
CI.
- Use `opendal_core::raw::Access`, `Layer`, and `LayeredAccess` for internal
implementations.
- Use `opendal_core::raw::oio::{ReadStream, Write, List, Delete}` for
operation bodies.
- Use `Operator` and `blocking::Operator` as the public API entry points.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d75534963..e021c6a2b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -97,7 +97,7 @@ Rustup will read OpenDAL's `rust-toolchain.toml` and set up
everything else auto
```shell
$ cargo version
-cargo 1.85.0 (stable)
+cargo 1.91.0 (stable)
```
Some components may require specific setup steps. Please refer to their
respective `CONTRIBUTING` documentation for more details.
diff --git a/bindings/c/Cargo.toml b/bindings/c/Cargo.toml
index b0f791fa9..0b876a455 100644
--- a/bindings/c/Cargo.toml
+++ b/bindings/c/Cargo.toml
@@ -24,7 +24,7 @@ edition = "2021"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
[lib]
crate-type = ["cdylib", "staticlib"]
diff --git a/bindings/cpp/Cargo.toml b/bindings/cpp/Cargo.toml
index 5f99ce408..3dd166a77 100644
--- a/bindings/cpp/Cargo.toml
+++ b/bindings/cpp/Cargo.toml
@@ -24,7 +24,7 @@ edition = "2024"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
[lib]
crate-type = ["staticlib"]
diff --git a/bindings/dotnet/Cargo.toml b/bindings/dotnet/Cargo.toml
index 9e7aa575d..f1d508d71 100644
--- a/bindings/dotnet/Cargo.toml
+++ b/bindings/dotnet/Cargo.toml
@@ -24,7 +24,7 @@ edition = "2024"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
[lib]
crate-type = ["cdylib"]
diff --git a/bindings/haskell/Cargo.toml b/bindings/haskell/Cargo.toml
index 4b83eb96d..1dacd2602 100644
--- a/bindings/haskell/Cargo.toml
+++ b/bindings/haskell/Cargo.toml
@@ -24,7 +24,7 @@ edition = "2024"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
[lib]
crate-type = ["cdylib"]
diff --git a/bindings/haskell/src/lib.rs b/bindings/haskell/src/lib.rs
index c1178929c..231306d40 100644
--- a/bindings/haskell/src/lib.rs
+++ b/bindings/haskell/src/lib.rs
@@ -89,16 +89,15 @@ pub unsafe extern "C" fn via_map_ffi(
})
.collect::<HashMap<String, String>>();
- if let Some(callback) = callback {
- if let Err(e) = log::set_boxed_logger(Box::new(HsLogger { callback
}))
+ if let Some(callback) = callback
+ && let Err(e) = log::set_boxed_logger(Box::new(HsLogger { callback
}))
.map(|()| log::set_max_level(log::LevelFilter::Debug))
- {
- *result = FFIResult::err_with_source(
- "Failed to register logger",
- od::Error::new(od::ErrorKind::Unexpected,
e.to_string().as_str()),
- );
- return;
- }
+ {
+ *result = FFIResult::err_with_source(
+ "Failed to register logger",
+ od::Error::new(od::ErrorKind::Unexpected,
e.to_string().as_str()),
+ );
+ return;
}
let res = match od::Operator::via_iter(scheme, map) {
diff --git a/bindings/java/Cargo.toml b/bindings/java/Cargo.toml
index e88f5a348..9870e3930 100644
--- a/bindings/java/Cargo.toml
+++ b/bindings/java/Cargo.toml
@@ -24,7 +24,7 @@ edition = "2024"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
[lib]
crate-type = ["cdylib", "staticlib"]
diff --git a/bindings/lua/Cargo.toml b/bindings/lua/Cargo.toml
index 1e26f3029..761445ae6 100644
--- a/bindings/lua/Cargo.toml
+++ b/bindings/lua/Cargo.toml
@@ -24,7 +24,7 @@ edition = "2024"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
[features]
default = ["mlua/lua52"]
diff --git a/bindings/nodejs/Cargo.toml b/bindings/nodejs/Cargo.toml
index f9782b7a7..e39be989b 100644
--- a/bindings/nodejs/Cargo.toml
+++ b/bindings/nodejs/Cargo.toml
@@ -24,7 +24,7 @@ edition = "2024"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
[features]
default = [
diff --git a/bindings/ocaml/Cargo.toml b/bindings/ocaml/Cargo.toml
index 82bb8d277..74e501446 100644
--- a/bindings/ocaml/Cargo.toml
+++ b/bindings/ocaml/Cargo.toml
@@ -24,7 +24,7 @@ edition = "2024"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
[lib]
crate-type = ["cdylib"]
diff --git a/bindings/php/Cargo.toml b/bindings/php/Cargo.toml
index 6fe8e29bd..8e6ce7ac2 100644
--- a/bindings/php/Cargo.toml
+++ b/bindings/php/Cargo.toml
@@ -24,7 +24,7 @@ edition = "2024"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
[lib]
crate-type = ["cdylib"]
diff --git a/bindings/python/Cargo.toml b/bindings/python/Cargo.toml
index 03d7be5c2..764a1626c 100644
--- a/bindings/python/Cargo.toml
+++ b/bindings/python/Cargo.toml
@@ -24,7 +24,7 @@ edition = "2024"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
version = "0.47.2"
[features]
diff --git a/bindings/ruby/Cargo.toml b/bindings/ruby/Cargo.toml
index bdc0db490..e0ef970c7 100644
--- a/bindings/ruby/Cargo.toml
+++ b/bindings/ruby/Cargo.toml
@@ -24,7 +24,7 @@ edition = "2024"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
version = "0.1.7-rc.2"
[lib]
diff --git a/bindings/ruby/opendal.gemspec b/bindings/ruby/opendal.gemspec
index 076d7a819..83e006eee 100644
--- a/bindings/ruby/opendal.gemspec
+++ b/bindings/ruby/opendal.gemspec
@@ -93,7 +93,7 @@ Gem::Specification.new do |spec|
# Exclude non-Ruby files from RDoc to prevent parsing errors
spec.rdoc_options = ["--exclude", "Cargo\\..*", "--exclude", "core/",
"--exclude", "\\.rs$"]
- spec.requirements = ["Rust >= 1.85"]
+ spec.requirements = ["Rust >= 1.91"]
# use a Ruby version which:
# - supports Rubygems with the ability of compilation of Rust gem
# - not end of life
diff --git a/core/Cargo.lock b/core/Cargo.lock
index c744aad2b..1a34d396d 100644
--- a/core/Cargo.lock
+++ b/core/Cargo.lock
@@ -3047,17 +3047,6 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
-[[package]]
-name = "erased-serde"
-version = "0.4.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2add8a07dd6a8d93ff627029c51de145e12686fbc36ecb298ac22e74cf02dec"
-dependencies = [
- "serde",
- "serde_core",
- "typeid",
-]
-
[[package]]
name = "errno"
version = "0.3.14"
@@ -3198,15 +3187,15 @@ dependencies = [
[[package]]
name = "fastrace"
-version = "0.7.17"
+version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2130caec636d7a1d23b173576674ced1af967228642ceaeb6a1b4705c282b00e"
+checksum = "74539685f6baa3c33251571272eac7939fc3b93dff97c30381d7a6267394e528"
dependencies = [
"fastant",
"fastrace-macro",
"parking_lot 0.12.5",
"pin-project",
- "rand 0.9.4",
+ "rand 0.10.1",
"rtrb",
"serde",
]
@@ -3224,11 +3213,10 @@ dependencies = [
[[package]]
name = "fastrace-macro"
-version = "0.7.17"
+version = "0.7.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b35f67e02527fca6515ff61f922360df781f477daf6a806fff16bd59525dee5"
+checksum = "390d4f754b751905fa9294716c4ead717ffb5fa733a0c2417358b7779fceaeed"
dependencies = [
- "proc-macro-error2",
"proc-macro2",
"quote",
"syn 2.0.118",
@@ -5424,29 +5412,29 @@ version = "0.4.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
dependencies = [
- "sval",
- "sval_ref",
"value-bag",
]
[[package]]
name = "logforth"
-version = "0.29.1"
+version = "0.30.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "40c105c59828d07aeb95b06f9a345b12869ddc249d44a7302697a66da439076f"
+checksum = "522000d3921e4b089de59204d2d3ca8792cd53f8ce5a54b5ac8b9a6e867259f0"
dependencies = [
+ "log",
"logforth-append-file",
"logforth-bridge-log",
"logforth-core",
+ "logforth-filter-rustlog",
"logforth-layout-json",
"logforth-layout-text",
]
[[package]]
name = "logforth-append-file"
-version = "0.3.0"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d2ccb8b7e501c114e80069eb2b83c02a48039c23a7037e717b5b09a4ed306fb"
+checksum = "80f4ed78a03a30c12285135d98330f0f5d53cb0019bd1ac6d66863dae72d8d52"
dependencies = [
"jiff",
"logforth-core",
@@ -5454,9 +5442,9 @@ dependencies = [
[[package]]
name = "logforth-bridge-log"
-version = "0.3.0"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4aa6ca548389fd166a995b5940e15b0dacbdd5a30f2f24eac9aa4bf664bda5c"
+checksum = "9c7224c78547e542572ae4d1f787f96c4395a4c3f24513bf221bd8e49888f610"
dependencies = [
"log",
"logforth-core",
@@ -5464,19 +5452,28 @@ dependencies = [
[[package]]
name = "logforth-core"
-version = "0.3.1"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a77869b8dba38c67ed19e1753e59d9faefdcc60557bc4e84db0348606a304ac5"
+checksum = "400ba5305e0cb6819efa6c2c503020562eb5b47fd53c91c935be55af1ffd374e"
dependencies = [
"anyhow",
- "value-bag",
+ "serde",
+]
+
+[[package]]
+name = "logforth-filter-rustlog"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5e8431cfa1d3eeca479c363651320a66c7003350528f678b30e8c1474fb0d802"
+dependencies = [
+ "logforth-core",
]
[[package]]
name = "logforth-layout-json"
-version = "0.3.0"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01b80d310e0670560404a825f64dbd78a8761c5bb7da952513e90ba9dd525bd2"
+checksum = "9d86a105f8f32151ca1e0a6d4097d478badb02d5715239ba0fa431a188a5d966"
dependencies = [
"jiff",
"logforth-core",
@@ -5486,9 +5483,9 @@ dependencies = [
[[package]]
name = "logforth-layout-text"
-version = "0.3.0"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2a4674e549a59eeac8e301584143186c433181bdc5460046a130becedef6a3d"
+checksum = "4eafe007ac55293d807e8c7f5a23002e2518d32e476e195443cde23e7845416a"
dependencies = [
"colored",
"jiff",
@@ -8628,7 +8625,7 @@ version = "0.13.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf"
dependencies = [
- "heck 0.4.1",
+ "heck 0.5.0",
"itertools 0.14.0",
"log",
"multimap",
@@ -8648,7 +8645,7 @@ version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "343d3bd7056eda839b03204e68deff7d1b13aba7af2b2fd16890697274262ee7"
dependencies = [
- "heck 0.4.1",
+ "heck 0.5.0",
"itertools 0.14.0",
"log",
"multimap",
@@ -10105,15 +10102,6 @@ dependencies = [
"serde_derive",
]
-[[package]]
-name = "serde_buf"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc948de1bbead18a61be0b33182636603ea0239ca2577b9704fc39eba900e4e5"
-dependencies = [
- "serde_core",
-]
-
[[package]]
name = "serde_bytes"
version = "0.11.19"
@@ -10144,15 +10132,6 @@ dependencies = [
"syn 2.0.118",
]
-[[package]]
-name = "serde_fmt"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e497af288b3b95d067a23a4f749f2861121ffcb2f6d8379310dcda040c345ed"
-dependencies = [
- "serde_core",
-]
-
[[package]]
name = "serde_json"
version = "1.0.150"
@@ -11111,84 +11090,6 @@ dependencies = [
"syn 2.0.118",
]
-[[package]]
-name = "sval"
-version = "2.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4a05195a68cb8336336413c3f52ea0467c7666f5f652e01ba807319ffcc090f2"
-
-[[package]]
-name = "sval_buffer"
-version = "2.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2887fd5e2454319f2f170860427f615451bb057fc9b3fd7f28b7a99ac2ccf0e4"
-dependencies = [
- "sval",
- "sval_ref",
-]
-
-[[package]]
-name = "sval_dynamic"
-version = "2.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "12ddf3833aa407554ad40be081aea9cc3ea6d6798832ec83dd35022b45373896"
-dependencies = [
- "sval",
-]
-
-[[package]]
-name = "sval_fmt"
-version = "2.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94398bdd2ee99eee108e0b7b0df9081700a96cdefac3add5c09ad3e6f2376bcb"
-dependencies = [
- "itoa",
- "ryu",
- "sval",
-]
-
-[[package]]
-name = "sval_json"
-version = "2.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f51ae40f37b541fdf81531e51d5071e8edc7c5a191cc23d288b654995b9eaba"
-dependencies = [
- "itoa",
- "ryu",
- "sval",
-]
-
-[[package]]
-name = "sval_nested"
-version = "2.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3abe05be8455348e3f6edc14a85fd2fcf32f801a14f0126ce025e63851b4f13b"
-dependencies = [
- "sval",
- "sval_buffer",
- "sval_ref",
-]
-
-[[package]]
-name = "sval_ref"
-version = "2.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a36361fa3c42c9fd129f4c5023a812d5b275742b28a672c758ec70049c61df00"
-dependencies = [
- "sval",
-]
-
-[[package]]
-name = "sval_serde"
-version = "2.19.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb76707179eccecab345902a803aacacab6889f3af675dbe89766bc790b1a6cb"
-dependencies = [
- "serde_core",
- "sval",
- "sval_nested",
-]
-
[[package]]
name = "symlink"
version = "0.1.0"
@@ -11338,7 +11239,7 @@ source =
"registry+https://github.com/rust-lang/crates.io-index"
checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
dependencies = [
"fastrand",
- "getrandom 0.3.4",
+ "getrandom 0.4.2",
"once_cell",
"rustix 1.1.4",
"windows-sys 0.61.2",
@@ -12163,12 +12064,6 @@ dependencies = [
"syn 2.0.118",
]
-[[package]]
-name = "typeid"
-version = "1.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c"
-
[[package]]
name = "typenum"
version = "1.20.0"
@@ -12320,37 +12215,6 @@ name = "value-bag"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ba6f5989077681266825251a52748b8c1d8a4ad098cc37e440103d0ea717fc0"
-dependencies = [
- "value-bag-serde1",
- "value-bag-sval2",
-]
-
-[[package]]
-name = "value-bag-serde1"
-version = "1.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "16530907bfe2999a1773ca5900a65101e092c70f642f25cc23ca0c43573262c5"
-dependencies = [
- "erased-serde",
- "serde_buf",
- "serde_core",
- "serde_fmt",
-]
-
-[[package]]
-name = "value-bag-sval2"
-version = "1.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d00ae130edd690eaa877e4f40605d534790d1cf1d651e7685bd6a144521b251f"
-dependencies = [
- "sval",
- "sval_buffer",
- "sval_dynamic",
- "sval_fmt",
- "sval_json",
- "sval_ref",
- "sval_serde",
-]
[[package]]
name = "vart"
diff --git a/core/Cargo.toml b/core/Cargo.toml
index 22cd945bc..7613f9bed 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -38,7 +38,7 @@ edition = "2024"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
version = "0.57.0"
[workspace.dependencies]
@@ -48,7 +48,7 @@ ctor = "1.0.7"
futures = { version = "0.3", default-features = false }
http = "1.4"
log = { version = "0.4.32" }
-logforth = { version = "0.29.1", features = ["starter-log"] }
+logforth = { version = "0.30.1", features = ["starter-log"] }
mea = "0.6"
quick-xml = { version = "0.41.0", default-features = false }
rand = "0.10.1"
diff --git a/core/core/src/layers/correctness_check.rs
b/core/core/src/layers/correctness_check.rs
index b2de8ce35..f10ef96b9 100644
--- a/core/core/src/layers/correctness_check.rs
+++ b/core/core/src/layers/correctness_check.rs
@@ -143,15 +143,15 @@ impl Service for CorrectnessService {
if args.if_match().is_some() && !capability.write_with_if_match {
return Err(new_unsupported_error(scheme, Operation::Write,
"if_match"));
}
- if let Some(if_none_match) = args.if_none_match() {
- if !capability.write_with_if_none_match {
- let mut err = new_unsupported_error(scheme, Operation::Write,
"if_none_match");
- if if_none_match == "*" && capability.write_with_if_not_exists
{
- err = err.with_context("hint", "use if_not_exists
instead");
- }
-
- return Err(err);
+ if let Some(if_none_match) = args.if_none_match()
+ && !capability.write_with_if_none_match
+ {
+ let mut err = new_unsupported_error(scheme, Operation::Write,
"if_none_match");
+ if if_none_match == "*" && capability.write_with_if_not_exists {
+ err = err.with_context("hint", "use if_not_exists instead");
}
+
+ return Err(err);
}
self.inner.write(ctx, path, args)
diff --git a/core/core/src/raw/oio/copy/api.rs
b/core/core/src/raw/oio/copy/api.rs
index 24f75aa1a..f996bc661 100644
--- a/core/core/src/raw/oio/copy/api.rs
+++ b/core/core/src/raw/oio/copy/api.rs
@@ -134,10 +134,10 @@ impl Copy for OneShotCopier {
.set_persistent());
}
- if self.fut.is_none() {
- if let Some(factory) = self.factory.as_mut() {
- self.fut = Some(factory());
- }
+ if self.fut.is_none()
+ && let Some(factory) = self.factory.as_mut()
+ {
+ self.fut = Some(factory());
}
if let Some(fut) = self.fut.take() {
diff --git a/core/core/src/services/memory/config.rs
b/core/core/src/services/memory/config.rs
index f22e422d9..d42b41d59 100644
--- a/core/core/src/services/memory/config.rs
+++ b/core/core/src/services/memory/config.rs
@@ -34,10 +34,10 @@ impl crate::Configurator for MemoryConfig {
fn from_uri(uri: &crate::types::OperatorUri) -> crate::Result<Self> {
let mut map = uri.options().clone();
- if !map.contains_key("root") {
- if let Some(root) = uri.root().filter(|v| !v.is_empty()) {
- map.insert("root".to_string(), root.to_string());
- }
+ if !map.contains_key("root")
+ && let Some(root) = uri.root().filter(|v| !v.is_empty())
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/core/src/types/context/read.rs
b/core/core/src/types/context/read.rs
index f14ed168f..0f8e64fb5 100644
--- a/core/core/src/types/context/read.rs
+++ b/core/core/src/types/context/read.rs
@@ -106,10 +106,10 @@ impl ReadContext {
/// Observe read response and cache metadata if available.
pub(crate) fn observe_read_response(&self, rp: RpRead) {
- if let Some(metadata) = rp.into_metadata() {
- if self.metadata().is_none() {
- self.set_metadata(metadata);
- }
+ if let Some(metadata) = rp.into_metadata()
+ && self.metadata().is_none()
+ {
+ self.set_metadata(metadata);
}
}
diff --git a/core/core/src/types/context/write.rs
b/core/core/src/types/context/write.rs
index 1bdfded45..17336b428 100644
--- a/core/core/src/types/context/write.rs
+++ b/core/core/src/types/context/write.rs
@@ -214,7 +214,7 @@ mod tests {
use bytes::Bytes;
use log::debug;
use logforth::append::Testing;
- use logforth::filter::env_filter::EnvFilterBuilder;
+ use logforth::filter::rustlog::RustLogFilterBuilder;
use logforth::layout::TextLayout;
use mea::mutex::Mutex;
use pretty_assertions::assert_eq;
@@ -266,7 +266,7 @@ mod tests {
fn setup() {
let _ = logforth::starter_log::builder()
.dispatch(|d| {
- d.filter(EnvFilterBuilder::from_default_env().build())
+ d.filter(RustLogFilterBuilder::from_default_env().build())
.append(Testing::default().with_layout(TextLayout::default()))
})
.try_apply();
diff --git a/core/edge/s3_aws_assume_role_with_web_identity/src/main.rs
b/core/edge/s3_aws_assume_role_with_web_identity/src/main.rs
index 8704d3dee..8a9f42a66 100644
--- a/core/edge/s3_aws_assume_role_with_web_identity/src/main.rs
+++ b/core/edge/s3_aws_assume_role_with_web_identity/src/main.rs
@@ -16,7 +16,7 @@
// under the License.
use logforth::append::Testing;
-use logforth::filter::env_filter::EnvFilterBuilder;
+use logforth::filter::rustlog::RustLogFilterBuilder;
use logforth::layout::TextLayout;
use opendal::tests::init_test_service;
@@ -24,7 +24,7 @@ use opendal::tests::init_test_service;
async fn main() {
let _ = logforth::starter_log::builder()
.dispatch(|d| {
- d.filter(EnvFilterBuilder::from_default_env().build())
+ d.filter(RustLogFilterBuilder::from_default_env().build())
.append(Testing::default().with_layout(TextLayout::default()))
})
.try_apply();
diff --git a/core/layers/fastrace/Cargo.toml b/core/layers/fastrace/Cargo.toml
index c295c3119..a4bc0edb2 100644
--- a/core/layers/fastrace/Cargo.toml
+++ b/core/layers/fastrace/Cargo.toml
@@ -31,7 +31,7 @@ version = { workspace = true }
all-features = true
[dependencies]
-fastrace = "0.7.16"
+fastrace = { version = "0.7.18" }
opendal-core = { path = "../../core", version = "0.57.0", default-features =
false }
[dev-dependencies]
diff --git a/core/layers/immutable-index/src/lib.rs
b/core/layers/immutable-index/src/lib.rs
index 2819ea701..0ae2bbea7 100644
--- a/core/layers/immutable-index/src/lib.rs
+++ b/core/layers/immutable-index/src/lib.rs
@@ -279,7 +279,7 @@ mod tests {
use futures::TryStreamExt;
use log::debug;
use logforth::append::Testing;
- use logforth::filter::env_filter::EnvFilterBuilder;
+ use logforth::filter::rustlog::RustLogFilterBuilder;
use logforth::layout::TextLayout;
#[derive(Debug)]
@@ -393,7 +393,7 @@ mod tests {
fn setup() {
let _ = logforth::starter_log::builder()
.dispatch(|d| {
- d.filter(EnvFilterBuilder::from_default_env().build())
+ d.filter(RustLogFilterBuilder::from_default_env().build())
.append(Testing::default().with_layout(TextLayout::default()))
})
.try_apply();
diff --git a/core/layers/retry/src/lib.rs b/core/layers/retry/src/lib.rs
index 416fe1d67..664dcce27 100644
--- a/core/layers/retry/src/lib.rs
+++ b/core/layers/retry/src/lib.rs
@@ -1034,7 +1034,7 @@ mod tests {
use futures::TryStreamExt;
use futures::stream;
use logforth::append::Testing;
- use logforth::filter::env_filter::EnvFilterBuilder;
+ use logforth::filter::rustlog::RustLogFilterBuilder;
use logforth::layout::TextLayout;
use opendal_layer_logging::LoggingLayer;
@@ -1366,7 +1366,7 @@ mod tests {
fn setup() {
let _ = logforth::starter_log::builder()
.dispatch(|d| {
- d.filter(EnvFilterBuilder::from_default_env().build())
+ d.filter(RustLogFilterBuilder::from_default_env().build())
.append(Testing::default().with_layout(TextLayout::default()))
})
.try_apply();
diff --git a/core/layers/route/src/lib.rs b/core/layers/route/src/lib.rs
index 1bf5790a5..59a9b3c30 100644
--- a/core/layers/route/src/lib.rs
+++ b/core/layers/route/src/lib.rs
@@ -340,16 +340,16 @@ impl oio::Delete for RouteDeleter {
async fn close(&mut self) -> Result<()> {
let mut first_err = None;
- if let Some(deleter) = self.default_deleter.as_mut() {
- if let Err(err) = deleter.close().await {
- first_err = Some(err);
- }
+ if let Some(deleter) = self.default_deleter.as_mut()
+ && let Err(err) = deleter.close().await
+ {
+ first_err = Some(err);
}
for deleter in self.target_deleters.iter_mut().flatten() {
- if let Err(err) = deleter.close().await {
- if first_err.is_none() {
- first_err = Some(err);
- }
+ if let Err(err) = deleter.close().await
+ && first_err.is_none()
+ {
+ first_err = Some(err);
}
}
diff --git a/core/services/alluxio/src/config.rs
b/core/services/alluxio/src/config.rs
index 1a202f2fa..8d27ff9f0 100644
--- a/core/services/alluxio/src/config.rs
+++ b/core/services/alluxio/src/config.rs
@@ -57,10 +57,10 @@ impl opendal_core::Configurator for AlluxioConfig {
map.insert("endpoint".to_string(), format!("http://{authority}"));
}
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/azblob/src/core.rs b/core/services/azblob/src/core.rs
index 39f1c4258..f714e9af9 100644
--- a/core/services/azblob/src/core.rs
+++ b/core/services/azblob/src/core.rs
@@ -1169,20 +1169,19 @@ mod error {
};
// If there is no body here, fill with error code.
- if message.is_empty() {
- if let Some(code) = parts
+ if message.is_empty()
+ && let Some(code) = parts
.headers
.get("x-ms-error-code")
.and_then(|v| v.to_str().ok())
- {
- message = format!(
- "{:?}",
- AzblobError {
- code: code.to_string(),
- ..Default::default()
- }
- );
- }
+ {
+ message = format!(
+ "{:?}",
+ AzblobError {
+ code: code.to_string(),
+ ..Default::default()
+ }
+ );
}
let mut err = Error::new(kind, &message);
diff --git a/core/services/azdls/src/core.rs b/core/services/azdls/src/core.rs
index 30422810b..4e2d34e24 100644
--- a/core/services/azdls/src/core.rs
+++ b/core/services/azdls/src/core.rs
@@ -200,10 +200,10 @@ impl AzdlsCore {
req = req.header(IF_NONE_MATCH, v)
}
- if let Some(user_metadata) = args.user_metadata() {
- if !user_metadata.is_empty() {
- req = req.header(X_MS_PROPERTIES,
encode_user_metadata(user_metadata));
- }
+ if let Some(user_metadata) = args.user_metadata()
+ && !user_metadata.is_empty()
+ {
+ req = req.header(X_MS_PROPERTIES,
encode_user_metadata(user_metadata));
}
let operation = if resource == DIRECTORY {
diff --git a/core/services/b2/src/lister.rs b/core/services/b2/src/lister.rs
index 70ffe644f..8b3232e71 100644
--- a/core/services/b2/src/lister.rs
+++ b/core/services/b2/src/lister.rs
@@ -95,10 +95,10 @@ impl oio::PageList for B2Lister {
}
for file in output.files {
- if let Some(start_after) = self.start_after.clone() {
- if build_abs_path(&self.core.root, &start_after) ==
file.file_name {
- continue;
- }
+ if let Some(start_after) = self.start_after.clone()
+ && build_abs_path(&self.core.root, &start_after) ==
file.file_name
+ {
+ continue;
}
let file_name = file.file_name.clone();
let metadata = parse_file_info(&file);
diff --git a/core/services/cacache/src/config.rs
b/core/services/cacache/src/config.rs
index 30e7b0603..ff7d68bc0 100644
--- a/core/services/cacache/src/config.rs
+++ b/core/services/cacache/src/config.rs
@@ -32,11 +32,11 @@ impl opendal_core::Configurator for CacacheConfig {
fn from_uri(uri: &opendal_core::OperatorUri) -> opendal_core::Result<Self>
{
let mut map = uri.options().clone();
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.entry("datadir".to_string())
- .or_insert_with(|| format!("/{root}"));
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.entry("datadir".to_string())
+ .or_insert_with(|| format!("/{root}"));
}
Self::from_iter(map)
diff --git a/core/services/cloudflare-kv/src/backend.rs
b/core/services/cloudflare-kv/src/backend.rs
index 4856f5afc..f22b69587 100644
--- a/core/services/cloudflare-kv/src/backend.rs
+++ b/core/services/cloudflare-kv/src/backend.rs
@@ -121,13 +121,13 @@ impl Builder for CloudflareKvBuilder {
};
// Validate default TTL is at least 60 seconds if specified
- if let Some(ttl) = self.config.default_ttl {
- if ttl < Duration::from_secs(60) {
- return Err(Error::new(
- ErrorKind::ConfigInvalid,
- "Default TTL must be at least 60 seconds",
- ));
- }
+ if let Some(ttl) = self.config.default_ttl
+ && ttl < Duration::from_secs(60)
+ {
+ return Err(Error::new(
+ ErrorKind::ConfigInvalid,
+ "Default TTL must be at least 60 seconds",
+ ));
}
let root = normalize_root(
@@ -265,10 +265,10 @@ impl Service for CloudflareKvBackend {
.map_err(new_json_deserialize_error)?;
// If listing returns results, treat as directory
- if let Some(entries) = list_result.result {
- if !entries.is_empty() {
- return
Ok(RpStat::new(Metadata::new(EntryMode::DIR)));
- }
+ if let Some(entries) = list_result.result
+ && !entries.is_empty()
+ {
+ return Ok(RpStat::new(Metadata::new(EntryMode::DIR)));
}
// Empty or no results means not found
@@ -314,20 +314,20 @@ impl Service for CloudflareKvBackend {
};
// Check if_match condition
- if let Some(if_match) = &args.if_match() {
- if if_match != &metadata.etag {
- return Err(Error::new(ErrorKind::ConditionNotMatch, "etag
mismatch"));
- }
+ if let Some(if_match) = &args.if_match()
+ && if_match != &metadata.etag
+ {
+ return Err(Error::new(ErrorKind::ConditionNotMatch, "etag
mismatch"));
}
// Check if_none_match condition
- if let Some(if_none_match) = &args.if_none_match() {
- if if_none_match == &metadata.etag {
- return Err(Error::new(
- ErrorKind::ConditionNotMatch,
- "etag match when expected none match",
- ));
- }
+ if let Some(if_none_match) = &args.if_none_match()
+ && if_none_match == &metadata.etag
+ {
+ return Err(Error::new(
+ ErrorKind::ConditionNotMatch,
+ "etag match when expected none match",
+ ));
}
// Parse since time once for both time-based conditions
@@ -337,23 +337,23 @@ impl Service for CloudflareKvBackend {
.map_err(|_| Error::new(ErrorKind::Unsupported, "invalid since
format"))?;
// Check modified_since condition
- if let Some(modified_since) = &args.if_modified_since() {
- if !last_modified.gt(modified_since) {
- return Err(Error::new(
- ErrorKind::ConditionNotMatch,
- "not modified since specified time",
- ));
- }
+ if let Some(modified_since) = &args.if_modified_since()
+ && !last_modified.gt(modified_since)
+ {
+ return Err(Error::new(
+ ErrorKind::ConditionNotMatch,
+ "not modified since specified time",
+ ));
}
// Check unmodified_since condition
- if let Some(unmodified_since) = &args.if_unmodified_since() {
- if !last_modified.le(unmodified_since) {
- return Err(Error::new(
- ErrorKind::ConditionNotMatch,
- "modified since specified time",
- ));
- }
+ if let Some(unmodified_since) = &args.if_unmodified_since()
+ && !last_modified.le(unmodified_since)
+ {
+ return Err(Error::new(
+ ErrorKind::ConditionNotMatch,
+ "modified since specified time",
+ ));
}
let meta = Metadata::new(if metadata.is_dir {
diff --git a/core/services/cloudflare-kv/src/config.rs
b/core/services/cloudflare-kv/src/config.rs
index 33a67ce79..cad44d7ea 100644
--- a/core/services/cloudflare-kv/src/config.rs
+++ b/core/services/cloudflare-kv/src/config.rs
@@ -84,10 +84,10 @@ impl opendal_core::Configurator for CloudflareKvConfig {
map.insert("account_id".to_string(), account_id.to_string());
map.insert("namespace_id".to_string(), namespace_id.to_string());
- if let Some(rest) = segments.next() {
- if !rest.is_empty() {
- map.insert("root".to_string(), rest.to_string());
- }
+ if let Some(rest) = segments.next()
+ && !rest.is_empty()
+ {
+ map.insert("root".to_string(), rest.to_string());
}
Self::from_iter(map)
diff --git a/core/services/cloudflare-kv/src/core.rs
b/core/services/cloudflare-kv/src/core.rs
index 80e88fe2e..b99f98a4b 100644
--- a/core/services/cloudflare-kv/src/core.rs
+++ b/core/services/cloudflare-kv/src/core.rs
@@ -153,10 +153,10 @@ impl CloudflareKvCore {
) -> Result<Response<Buffer>> {
let url = format!("{}/keys", self.url_prefix());
let mut url = QueryPairsWriter::new(&url);
- if let Some(cursor) = cursor {
- if !cursor.is_empty() {
- url = url.push("cursor", &cursor);
- }
+ if let Some(cursor) = cursor
+ && !cursor.is_empty()
+ {
+ url = url.push("cursor", &cursor);
}
url = url.push("limit", &limit.unwrap_or(1000).to_string());
url = url.push("prefix", &percent_encode_path(prefix));
diff --git a/core/services/cloudflare-kv/src/reader.rs
b/core/services/cloudflare-kv/src/reader.rs
index 5378add2f..cf1f75013 100644
--- a/core/services/cloudflare-kv/src/reader.rs
+++ b/core/services/cloudflare-kv/src/reader.rs
@@ -88,20 +88,20 @@ impl oio::StreamRead for CloudflareKvReader {
let metadata = cf_response.result.unwrap();
// Check if_match condition
- if let Some(if_match) = &args.if_match() {
- if if_match != &metadata.etag {
- return Err(Error::new(ErrorKind::ConditionNotMatch, "etag
mismatch"));
- }
+ if let Some(if_match) = &args.if_match()
+ && if_match != &metadata.etag
+ {
+ return Err(Error::new(ErrorKind::ConditionNotMatch, "etag
mismatch"));
}
// Check if_none_match condition
- if let Some(if_none_match) = &args.if_none_match() {
- if if_none_match == &metadata.etag {
- return Err(Error::new(
- ErrorKind::ConditionNotMatch,
- "etag match when expected none match",
- ));
- }
+ if let Some(if_none_match) = &args.if_none_match()
+ && if_none_match == &metadata.etag
+ {
+ return Err(Error::new(
+ ErrorKind::ConditionNotMatch,
+ "etag match when expected none match",
+ ));
}
// Parse since time once for both time-based conditions
@@ -111,23 +111,23 @@ impl oio::StreamRead for CloudflareKvReader {
.map_err(|_| Error::new(ErrorKind::Unsupported, "invalid since
format"))?;
// Check modified_since condition
- if let Some(modified_since) = &args.if_modified_since() {
- if !last_modified.gt(modified_since) {
- return Err(Error::new(
- ErrorKind::ConditionNotMatch,
- "not modified since specified time",
- ));
- }
+ if let Some(modified_since) = &args.if_modified_since()
+ && !last_modified.gt(modified_since)
+ {
+ return Err(Error::new(
+ ErrorKind::ConditionNotMatch,
+ "not modified since specified time",
+ ));
}
// Check unmodified_since condition
- if let Some(unmodified_since) = &args.if_unmodified_since() {
- if !last_modified.le(unmodified_since) {
- return Err(Error::new(
- ErrorKind::ConditionNotMatch,
- "modified since specified time",
- ));
- }
+ if let Some(unmodified_since) = &args.if_unmodified_since()
+ && !last_modified.le(unmodified_since)
+ {
+ return Err(Error::new(
+ ErrorKind::ConditionNotMatch,
+ "modified since specified time",
+ ));
}
}
diff --git a/core/services/compfs/src/backend.rs
b/core/services/compfs/src/backend.rs
index 7b9294689..57c58a03f 100644
--- a/core/services/compfs/src/backend.rs
+++ b/core/services/compfs/src/backend.rs
@@ -61,15 +61,15 @@ impl Builder for CompfsBuilder {
}?;
// If root dir does not exist, we must create it.
- if let Err(e) = std::fs::metadata(&root) {
- if e.kind() == std::io::ErrorKind::NotFound {
- std::fs::create_dir_all(&root).map_err(|e| {
- Error::new(ErrorKind::Unexpected, "create root dir failed")
- .with_operation("Builder::build")
- .with_context("root", root.as_str())
- .set_source(e)
- })?;
- }
+ if let Err(e) = std::fs::metadata(&root)
+ && e.kind() == std::io::ErrorKind::NotFound
+ {
+ std::fs::create_dir_all(&root).map_err(|e| {
+ Error::new(ErrorKind::Unexpected, "create root dir failed")
+ .with_operation("Builder::build")
+ .with_context("root", root.as_str())
+ .set_source(e)
+ })?;
}
let dispatcher = Dispatcher::new().map_err(|_| {
diff --git a/core/services/compfs/src/config.rs
b/core/services/compfs/src/config.rs
index 52085187a..b54145dca 100644
--- a/core/services/compfs/src/config.rs
+++ b/core/services/compfs/src/config.rs
@@ -35,10 +35,10 @@ impl opendal_core::Configurator for CompfsConfig {
fn from_uri(uri: &opendal_core::OperatorUri) -> opendal_core::Result<Self>
{
let mut map = uri.options().clone();
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/cos/src/backend.rs b/core/services/cos/src/backend.rs
index bbe75efd6..ac75be261 100644
--- a/core/services/cos/src/backend.rs
+++ b/core/services/cos/src/backend.rs
@@ -349,10 +349,10 @@ impl Service for CosBackend {
meta = meta.with_user_metadata(user_meta);
}
- if let Some(v) = parse_header_to_str(headers,
constants::X_COS_VERSION_ID)? {
- if v != "null" {
- meta.set_version(v);
- }
+ if let Some(v) = parse_header_to_str(headers,
constants::X_COS_VERSION_ID)?
+ && v != "null"
+ {
+ meta.set_version(v);
}
Ok(RpStat::new(meta))
diff --git a/core/services/cos/src/writer.rs b/core/services/cos/src/writer.rs
index 12c6b4264..8c5dd2cfd 100644
--- a/core/services/cos/src/writer.rs
+++ b/core/services/cos/src/writer.rs
@@ -60,10 +60,10 @@ impl CosWriter {
if let Some(md5) = parse_content_md5(headers)? {
meta.set_content_md5(md5);
}
- if let Some(version) = parse_header_to_str(headers,
constants::X_COS_VERSION_ID)? {
- if version != "null" {
- meta.set_version(version);
- }
+ if let Some(version) = parse_header_to_str(headers,
constants::X_COS_VERSION_ID)?
+ && version != "null"
+ {
+ meta.set_version(version);
}
Ok(meta)
diff --git a/core/services/d1/src/config.rs b/core/services/d1/src/config.rs
index 7548acbc0..ec66174e3 100644
--- a/core/services/d1/src/config.rs
+++ b/core/services/d1/src/config.rs
@@ -89,10 +89,10 @@ impl opendal_core::Configurator for D1Config {
map.insert("account_id".to_string(), account_id.to_string());
map.insert("database_id".to_string(), database_id.to_string());
- if let Some(rest) = segments.next() {
- if !rest.is_empty() {
- map.insert("root".to_string(), rest.to_string());
- }
+ if let Some(rest) = segments.next()
+ && !rest.is_empty()
+ {
+ map.insert("root".to_string(), rest.to_string());
}
Self::from_iter(map)
diff --git a/core/services/dashmap/src/config.rs
b/core/services/dashmap/src/config.rs
index 8a49b46f0..e9e9a95ef 100644
--- a/core/services/dashmap/src/config.rs
+++ b/core/services/dashmap/src/config.rs
@@ -37,10 +37,10 @@ impl Configurator for DashmapConfig {
fn from_uri(uri: &OperatorUri) -> Result<Self> {
let mut map = uri.options().clone();
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/dbfs/src/config.rs b/core/services/dbfs/src/config.rs
index 3a627470f..398cc96bf 100644
--- a/core/services/dbfs/src/config.rs
+++ b/core/services/dbfs/src/config.rs
@@ -51,10 +51,10 @@ impl opendal_core::Configurator for DbfsConfig {
map.insert("endpoint".to_string(), format!("https://{authority}"));
}
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/dropbox/src/config.rs
b/core/services/dropbox/src/config.rs
index 9093ce8c5..a9c4d8c8b 100644
--- a/core/services/dropbox/src/config.rs
+++ b/core/services/dropbox/src/config.rs
@@ -53,10 +53,10 @@ impl opendal_core::Configurator for DropboxConfig {
fn from_uri(uri: &opendal_core::OperatorUri) -> opendal_core::Result<Self>
{
let mut map = uri.options().clone();
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/etcd/src/config.rs b/core/services/etcd/src/config.rs
index cd743b364..e6ee0a03a 100644
--- a/core/services/etcd/src/config.rs
+++ b/core/services/etcd/src/config.rs
@@ -83,10 +83,10 @@ impl opendal_core::Configurator for EtcdConfig {
.or_insert_with(|| format!("http://{authority}"));
}
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/foundationdb/src/config.rs
b/core/services/foundationdb/src/config.rs
index c851d9e00..f3751c19a 100644
--- a/core/services/foundationdb/src/config.rs
+++ b/core/services/foundationdb/src/config.rs
@@ -38,11 +38,11 @@ impl opendal_core::Configurator for FoundationdbConfig {
fn from_uri(uri: &opendal_core::OperatorUri) -> opendal_core::Result<Self>
{
let mut map = uri.options().clone();
- if let Some(path) = uri.root() {
- if !path.is_empty() {
- map.entry("config_path".to_string())
- .or_insert_with(|| format!("/{path}"));
- }
+ if let Some(path) = uri.root()
+ && !path.is_empty()
+ {
+ map.entry("config_path".to_string())
+ .or_insert_with(|| format!("/{path}"));
}
Self::from_iter(map)
diff --git a/core/services/foyer/src/config.rs
b/core/services/foyer/src/config.rs
index 0056e0f91..534b07e10 100644
--- a/core/services/foyer/src/config.rs
+++ b/core/services/foyer/src/config.rs
@@ -68,10 +68,10 @@ impl Configurator for FoyerConfig {
map.insert("name".to_string(), name.to_string());
}
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/fs/src/backend.rs b/core/services/fs/src/backend.rs
index 829eba62c..918c19cea 100644
--- a/core/services/fs/src/backend.rs
+++ b/core/services/fs/src/backend.rs
@@ -79,31 +79,30 @@ impl Builder for FsBuilder {
debug!("backend use root {}", root.to_string_lossy());
// If root dir is not exist, we must create it.
- if let Err(e) = std::fs::metadata(&root) {
- if e.kind() == std::io::ErrorKind::NotFound {
- std::fs::create_dir_all(&root).map_err(|e| {
- Error::new(ErrorKind::Unexpected, "create root dir failed")
- .with_operation("Builder::build")
- .with_context("root", root.to_string_lossy())
- .set_source(e)
- })?;
- }
+ if let Err(e) = std::fs::metadata(&root)
+ && e.kind() == std::io::ErrorKind::NotFound
+ {
+ std::fs::create_dir_all(&root).map_err(|e| {
+ Error::new(ErrorKind::Unexpected, "create root dir failed")
+ .with_operation("Builder::build")
+ .with_context("root", root.to_string_lossy())
+ .set_source(e)
+ })?;
}
let atomic_write_dir = self.config.atomic_write_dir.map(PathBuf::from);
// If atomic write dir is not exist, we must create it.
- if let Some(d) = &atomic_write_dir {
- if let Err(e) = std::fs::metadata(d) {
- if e.kind() == std::io::ErrorKind::NotFound {
- std::fs::create_dir_all(d).map_err(|e| {
- Error::new(ErrorKind::Unexpected, "create atomic write
dir failed")
- .with_operation("Builder::build")
- .with_context("atomic_write_dir",
d.to_string_lossy())
- .set_source(e)
- })?;
- }
- }
+ if let Some(d) = &atomic_write_dir
+ && let Err(e) = std::fs::metadata(d)
+ && e.kind() == std::io::ErrorKind::NotFound
+ {
+ std::fs::create_dir_all(d).map_err(|e| {
+ Error::new(ErrorKind::Unexpected, "create atomic write dir
failed")
+ .with_operation("Builder::build")
+ .with_context("atomic_write_dir", d.to_string_lossy())
+ .set_source(e)
+ })?;
}
// Canonicalize the root directory. This should work since we already
know that we can
diff --git a/core/services/fs/src/core.rs b/core/services/fs/src/core.rs
index e6c54edeb..f2fdb8c03 100644
--- a/core/services/fs/src/core.rs
+++ b/core/services/fs/src/core.rs
@@ -231,10 +231,10 @@ impl FsCore {
// only *nix supports `write_with_user_metadata`
#[cfg(unix)]
{
- if let Ok(user_meta) = Self::get_user_metadata(&from) {
- if !user_meta.is_empty() {
- Self::set_user_metadata(&to, &user_meta)?;
- }
+ if let Ok(user_meta) = Self::get_user_metadata(&from)
+ && !user_meta.is_empty()
+ {
+ Self::set_user_metadata(&to, &user_meta)?;
}
}
@@ -285,12 +285,11 @@ impl FsCore {
for attr in attrs {
let attr_name = attr.to_string_lossy();
// Only read xattr in the "user." namespace and strip the prefix
- if let Some(key) = attr_name.strip_prefix(XATTR_USER_PREFIX) {
- if let Ok(Some(value)) = xattr::get(path, &attr) {
- if let Ok(v) = String::from_utf8(value) {
- user_metadata.insert(key.to_string(), v);
- }
- }
+ if let Some(key) = attr_name.strip_prefix(XATTR_USER_PREFIX)
+ && let Ok(Some(value)) = xattr::get(path, &attr)
+ && let Ok(v) = String::from_utf8(value)
+ {
+ user_metadata.insert(key.to_string(), v);
}
}
diff --git a/core/services/gcs/src/backend.rs b/core/services/gcs/src/backend.rs
index 2bb3a0c45..c038fb5de 100644
--- a/core/services/gcs/src/backend.rs
+++ b/core/services/gcs/src/backend.rs
@@ -302,14 +302,14 @@ impl Builder for GcsBuilder {
let mut credential_chain =
ProvideCredentialChain::new().push(default_credential.build());
- if !self.config.disable_vm_metadata {
- if let Some(service_account) =
self.config.service_account.as_deref() {
- credential_chain = credential_chain.push(
- VmMetadataCredentialProvider::new()
- .with_scope(&scope)
- .with_service_account(service_account),
- );
- }
+ if !self.config.disable_vm_metadata
+ && let Some(service_account) =
self.config.service_account.as_deref()
+ {
+ credential_chain = credential_chain.push(
+ VmMetadataCredentialProvider::new()
+ .with_scope(&scope)
+ .with_service_account(service_account),
+ );
}
if let Some(path) = self.config.credential_path.as_deref() {
@@ -317,10 +317,10 @@ impl Builder for GcsBuilder {
credential_chain.push_front(FileCredentialProvider::new(path).with_scope(&scope));
}
- if let Some(content) = self.config.credential.as_deref() {
- if let Ok(provider) =
StaticCredentialProvider::from_base64(content) {
- credential_chain =
credential_chain.push_front(provider.with_scope(&scope));
- }
+ if let Some(content) = self.config.credential.as_deref()
+ && let Ok(provider) =
StaticCredentialProvider::from_base64(content)
+ {
+ credential_chain =
credential_chain.push_front(provider.with_scope(&scope));
}
if let Some(token) = self.config.token.as_deref() {
diff --git a/core/services/gdrive/src/config.rs
b/core/services/gdrive/src/config.rs
index 51eceb119..f32e53a36 100644
--- a/core/services/gdrive/src/config.rs
+++ b/core/services/gdrive/src/config.rs
@@ -53,10 +53,10 @@ impl opendal_core::Configurator for GdriveConfig {
fn from_uri(uri: &opendal_core::OperatorUri) -> opendal_core::Result<Self>
{
let mut map = uri.options().clone();
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/gdrive/src/core.rs b/core/services/gdrive/src/core.rs
index 57b9983bc..682deaf2b 100644
--- a/core/services/gdrive/src/core.rs
+++ b/core/services/gdrive/src/core.rs
@@ -212,15 +212,14 @@ impl GdriveCore {
}
if let Some(tombstone_expires_at) =
lookup_recent_tombstone(&recent_entries.tombstones, path)
+ && tombstone_expires_at > entry.expires_at
{
- if tombstone_expires_at > entry.expires_at {
- return None;
- }
+ return None;
}
- if let Some(latest_entry) =
lookup_recent_entry(&recent_entries.entries, path) {
- if latest_entry.expires_at > entry.expires_at {
- return None;
- }
+ if let Some(latest_entry) =
lookup_recent_entry(&recent_entries.entries, path)
+ && latest_entry.expires_at > entry.expires_at
+ {
+ return None;
}
if recent_entry_in_scope(scope_path, path, metadata.mode(),
recursive) {
Some((path.clone(), metadata))
diff --git a/core/services/github/src/config.rs
b/core/services/github/src/config.rs
index 62e0fb5b5..6ab87deed 100644
--- a/core/services/github/src/config.rs
+++ b/core/services/github/src/config.rs
@@ -89,10 +89,10 @@ impl Configurator for GithubConfig {
map.insert("owner".to_string(), owner.to_string());
map.insert("repo".to_string(), repo.to_string());
- if let Some(rest) = remainder {
- if !rest.is_empty() {
- map.insert("root".to_string(), rest.to_string());
- }
+ if let Some(rest) = remainder
+ && !rest.is_empty()
+ {
+ map.insert("root".to_string(), rest.to_string());
}
Self::from_iter(map)
diff --git a/core/services/goosefs/src/config.rs
b/core/services/goosefs/src/config.rs
index 75c19ea67..99c8b1615 100644
--- a/core/services/goosefs/src/config.rs
+++ b/core/services/goosefs/src/config.rs
@@ -104,10 +104,10 @@ impl opendal_core::Configurator for GoosefsConfig {
// goosefs://host:port/path → master_addr = "host:port"
map.insert("master_addr".to_string(), authority.to_string());
}
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
}
diff --git a/core/services/goosefs/src/core.rs
b/core/services/goosefs/src/core.rs
index 950fd245f..61da57220 100644
--- a/core/services/goosefs/src/core.rs
+++ b/core/services/goosefs/src/core.rs
@@ -153,10 +153,10 @@ impl GoosefsCore {
// Double-check after acquiring write lock: another task may have
// initialised it while we were waiting.
let pid_now = self.ctx_pid.load(Ordering::Relaxed);
- if pid_now == current_pid {
- if let Some(ref ctx) = *guard {
- return Ok(Arc::clone(ctx));
- }
+ if pid_now == current_pid
+ && let Some(ref ctx) = *guard
+ {
+ return Ok(Arc::clone(ctx));
}
// If we had a stale context from a different process, drop it.
@@ -472,10 +472,10 @@ impl GoosefsCore {
if let Some(length) = info.length {
metadata.set_content_length(length as u64);
}
- if let Some(mtime) = info.last_modification_time_ms {
- if let Ok(ts) = Timestamp::from_millisecond(mtime) {
- metadata.set_last_modified(ts);
- }
+ if let Some(mtime) = info.last_modification_time_ms
+ && let Ok(ts) = Timestamp::from_millisecond(mtime)
+ {
+ metadata.set_last_modified(ts);
}
metadata
}
diff --git a/core/services/gridfs/src/config.rs
b/core/services/gridfs/src/config.rs
index b9d965a2c..a06c011b0 100644
--- a/core/services/gridfs/src/config.rs
+++ b/core/services/gridfs/src/config.rs
@@ -62,26 +62,26 @@ impl Configurator for GridfsConfig {
.or_insert_with(|| format!("mongodb://{authority}"));
}
- if let Some(path) = uri.root() {
- if !path.is_empty() {
- let mut segments = path.splitn(3, '/');
- if let Some(database) = segments.next() {
- if !database.is_empty() {
- map.entry("database".to_string())
- .or_insert_with(|| database.to_string());
- }
- }
- if let Some(bucket) = segments.next() {
- if !bucket.is_empty() {
- map.entry("bucket".to_string())
- .or_insert_with(|| bucket.to_string());
- }
- }
- if let Some(rest) = segments.next() {
- if !rest.is_empty() {
- map.insert("root".to_string(), rest.to_string());
- }
- }
+ if let Some(path) = uri.root()
+ && !path.is_empty()
+ {
+ let mut segments = path.splitn(3, '/');
+ if let Some(database) = segments.next()
+ && !database.is_empty()
+ {
+ map.entry("database".to_string())
+ .or_insert_with(|| database.to_string());
+ }
+ if let Some(bucket) = segments.next()
+ && !bucket.is_empty()
+ {
+ map.entry("bucket".to_string())
+ .or_insert_with(|| bucket.to_string());
+ }
+ if let Some(rest) = segments.next()
+ && !rest.is_empty()
+ {
+ map.insert("root".to_string(), rest.to_string());
}
}
diff --git a/core/services/hdfs-native/src/config.rs
b/core/services/hdfs-native/src/config.rs
index d2e4a5965..f3dbdb958 100644
--- a/core/services/hdfs-native/src/config.rs
+++ b/core/services/hdfs-native/src/config.rs
@@ -66,10 +66,10 @@ impl opendal_core::Configurator for HdfsNativeConfig {
map.insert("name_node".to_string(), format!("hdfs://{authority}"));
}
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/hdfs/src/backend.rs
b/core/services/hdfs/src/backend.rs
index 71e2b4a55..68e885f55 100644
--- a/core/services/hdfs/src/backend.rs
+++ b/core/services/hdfs/src/backend.rs
@@ -134,23 +134,22 @@ impl Builder for HdfsBuilder {
let client = builder.connect().map_err(new_std_io_error)?;
// Create root dir if not exist.
- if let Err(e) = client.metadata(&root) {
- if e.kind() == io::ErrorKind::NotFound {
- debug!("root {root} is not exist, creating now");
+ if let Err(e) = client.metadata(&root)
+ && e.kind() == io::ErrorKind::NotFound
+ {
+ debug!("root {root} is not exist, creating now");
- client.create_dir(&root).map_err(new_std_io_error)?
- }
+ client.create_dir(&root).map_err(new_std_io_error)?
}
let atomic_write_dir = self.config.atomic_write_dir;
// If atomic write dir is not exist, we must create it.
- if let Some(d) = &atomic_write_dir {
- if let Err(e) = client.metadata(d) {
- if e.kind() == io::ErrorKind::NotFound {
- client.create_dir(d).map_err(new_std_io_error)?
- }
- }
+ if let Some(d) = &atomic_write_dir
+ && let Err(e) = client.metadata(d)
+ && e.kind() == io::ErrorKind::NotFound
+ {
+ client.create_dir(d).map_err(new_std_io_error)?
}
Ok(HdfsBackend {
diff --git a/core/services/hdfs/src/config.rs b/core/services/hdfs/src/config.rs
index 8fedb2867..7fde59c74 100644
--- a/core/services/hdfs/src/config.rs
+++ b/core/services/hdfs/src/config.rs
@@ -71,10 +71,10 @@ impl opendal_core::Configurator for HdfsConfig {
map.insert("name_node".to_string(), format!("hdfs://{authority}"));
}
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/hf/src/backend.rs b/core/services/hf/src/backend.rs
index fc9411178..cf9da2e33 100644
--- a/core/services/hf/src/backend.rs
+++ b/core/services/hf/src/backend.rs
@@ -51,10 +51,10 @@ impl HfBuilder {
///
/// [Reference](https://huggingface.co/docs/hub/repositories)
pub fn repo_type(mut self, repo_type: &str) -> Self {
- if !repo_type.is_empty() {
- if let Ok(rt) = HfRepoType::parse(repo_type) {
- self.config.repo_type = Some(rt);
- }
+ if !repo_type.is_empty()
+ && let Ok(rt) = HfRepoType::parse(repo_type)
+ {
+ self.config.repo_type = Some(rt);
}
self
}
@@ -125,10 +125,10 @@ impl HfBuilder {
///
/// See
<https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables#hfhubdisablexet>.
pub fn download_mode(mut self, mode: &str) -> Self {
- if !mode.is_empty() {
- if let Ok(m) = HfDownloadMode::parse(mode) {
- self.config.download_mode = Some(m);
- }
+ if !mode.is_empty()
+ && let Ok(m) = HfDownloadMode::parse(mode)
+ {
+ self.config.download_mode = Some(m);
}
self
}
@@ -158,10 +158,10 @@ impl HfBuilder {
if let Some(mode) = self.config.download_mode {
return mode;
}
- if let Ok(val) = std::env::var("HF_HUB_DISABLE_XET") {
- if !val.is_empty() {
- return HfDownloadMode::Http;
- }
+ if let Ok(val) = std::env::var("HF_HUB_DISABLE_XET")
+ && !val.is_empty()
+ {
+ return HfDownloadMode::Http;
}
HfDownloadMode::default()
}
@@ -183,15 +183,15 @@ impl HfBuilder {
if let Some(t) = self.config.token.clone() {
return Some(t);
}
- if let Ok(val) = std::env::var("HF_HUB_DISABLE_IMPLICIT_TOKEN") {
- if !val.is_empty() {
- return None;
- }
+ if let Ok(val) = std::env::var("HF_HUB_DISABLE_IMPLICIT_TOKEN")
+ && !val.is_empty()
+ {
+ return None;
}
- if let Ok(t) = std::env::var("HF_TOKEN") {
- if !t.is_empty() {
- return Some(t);
- }
+ if let Ok(t) = std::env::var("HF_TOKEN")
+ && !t.is_empty()
+ {
+ return Some(t);
}
let token_path = if let Ok(p) = std::env::var("HF_TOKEN_PATH") {
Some(PathBuf::from(p))
diff --git a/core/services/hf/src/config.rs b/core/services/hf/src/config.rs
index 5ef944531..ccc6d67b2 100644
--- a/core/services/hf/src/config.rs
+++ b/core/services/hf/src/config.rs
@@ -87,18 +87,18 @@ impl opendal_core::Configurator for HfConfig {
// OperatorUri splits "hf://datasets/user/repo@rev/path" into
// name="datasets" and root="user/repo@rev/path".
let mut path = String::new();
- if let Some(name) = uri.name() {
- if !name.is_empty() {
- path.push_str(name);
- }
+ if let Some(name) = uri.name()
+ && !name.is_empty()
+ {
+ path.push_str(name);
}
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- if !path.is_empty() {
- path.push('/');
- }
- path.push_str(root);
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ if !path.is_empty() {
+ path.push('/');
}
+ path.push_str(root);
}
let download_mode = opts
diff --git a/core/services/hf/src/core.rs b/core/services/hf/src/core.rs
index 259648bc2..4ca219328 100644
--- a/core/services/hf/src/core.rs
+++ b/core/services/hf/src/core.rs
@@ -307,10 +307,10 @@ impl HfCore {
fn xet_token_refresh_headers(&self) -> http::HeaderMap {
let mut headers = http::HeaderMap::new();
- if let Some(token) = &self.token {
- if let Ok(val) = format!("Bearer {}", token).parse() {
- headers.insert(header::AUTHORIZATION, val);
- }
+ if let Some(token) = &self.token
+ && let Ok(val) = format!("Bearer {}", token).parse()
+ {
+ headers.insert(header::AUTHORIZATION, val);
}
headers
}
diff --git a/core/services/hf/src/lister.rs b/core/services/hf/src/lister.rs
index 7b498d879..819f14729 100644
--- a/core/services/hf/src/lister.rs
+++ b/core/services/hf/src/lister.rs
@@ -144,10 +144,10 @@ impl oio::PageList for HfLister {
let rel_path = build_rel_path(&self.core.root, &path);
// Filter by prefix when doing prefix-based listing.
- if let Some(prefix) = &self.prefix {
- if !rel_path.starts_with(prefix.as_str()) {
- continue;
- }
+ if let Some(prefix) = &self.prefix
+ && !rel_path.starts_with(prefix.as_str())
+ {
+ continue;
}
ctx.entries.push_back(oio::Entry::new(&rel_path, meta));
diff --git a/core/services/ipfs/src/config.rs b/core/services/ipfs/src/config.rs
index b80eba282..8e8dcea70 100644
--- a/core/services/ipfs/src/config.rs
+++ b/core/services/ipfs/src/config.rs
@@ -40,10 +40,10 @@ impl opendal_core::Configurator for IpfsConfig {
map.insert("endpoint".to_string(), format!("http://{authority}"));
}
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/ipmfs/src/config.rs
b/core/services/ipmfs/src/config.rs
index c9d1a8d7b..7275311e2 100644
--- a/core/services/ipmfs/src/config.rs
+++ b/core/services/ipmfs/src/config.rs
@@ -40,10 +40,10 @@ impl opendal_core::Configurator for IpmfsConfig {
map.insert("endpoint".to_string(), format!("http://{authority}"));
}
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/koofr/src/config.rs
b/core/services/koofr/src/config.rs
index fa3d5ab52..4272c8ef7 100644
--- a/core/services/koofr/src/config.rs
+++ b/core/services/koofr/src/config.rs
@@ -76,10 +76,10 @@ impl opendal_core::Configurator for KoofrConfig {
}
map.insert("email".to_string(), email.to_string());
- if let Some(rest) = segments.next() {
- if !rest.is_empty() {
- map.insert("root".to_string(), rest.to_string());
- }
+ if let Some(rest) = segments.next()
+ && !rest.is_empty()
+ {
+ map.insert("root".to_string(), rest.to_string());
}
Self::from_iter(map)
diff --git a/core/services/lakefs/src/config.rs
b/core/services/lakefs/src/config.rs
index 04a338808..e4a1d1e05 100644
--- a/core/services/lakefs/src/config.rs
+++ b/core/services/lakefs/src/config.rs
@@ -115,10 +115,10 @@ impl Configurator for LakefsConfig {
map.insert("branch".to_string(), branch.to_string());
}
- if let Some(root_part) = maybe_root {
- if !root_part.is_empty() {
- map.insert("root".to_string(), root_part.to_string());
- }
+ if let Some(root_part) = maybe_root
+ && !root_part.is_empty()
+ {
+ map.insert("root".to_string(), root_part.to_string());
}
}
}
diff --git a/core/services/lakefs/src/lister.rs
b/core/services/lakefs/src/lister.rs
index b2353d619..bdf948c51 100644
--- a/core/services/lakefs/src/lister.rs
+++ b/core/services/lakefs/src/lister.rs
@@ -99,10 +99,10 @@ impl oio::PageList for LakefsLister {
meta.set_last_modified(Timestamp::from_second(status.mtime).unwrap());
}
- if entry_type == EntryMode::FILE {
- if let Some(size_bytes) = status.size_bytes {
- meta.set_content_length(size_bytes);
- }
+ if entry_type == EntryMode::FILE
+ && let Some(size_bytes) = status.size_bytes
+ {
+ meta.set_content_length(size_bytes);
}
let path = if entry_type == EntryMode::DIR {
diff --git a/core/services/memcached/src/config.rs
b/core/services/memcached/src/config.rs
index 374c1dbc3..df8ab16b0 100644
--- a/core/services/memcached/src/config.rs
+++ b/core/services/memcached/src/config.rs
@@ -71,10 +71,10 @@ impl Configurator for MemcachedConfig {
map.insert("endpoint".to_string(), format!("tcp://{authority}"));
}
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/mini_moka/src/config.rs
b/core/services/mini_moka/src/config.rs
index 9138c4189..5ae0b632b 100644
--- a/core/services/mini_moka/src/config.rs
+++ b/core/services/mini_moka/src/config.rs
@@ -51,10 +51,10 @@ impl Configurator for MiniMokaConfig {
fn from_uri(uri: &OperatorUri) -> Result<Self> {
let mut map = uri.options().clone();
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/mongodb/src/config.rs
b/core/services/mongodb/src/config.rs
index f6dd8940c..8353a6c15 100644
--- a/core/services/mongodb/src/config.rs
+++ b/core/services/mongodb/src/config.rs
@@ -64,26 +64,26 @@ impl opendal_core::Configurator for MongodbConfig {
.or_insert_with(|| format!("mongodb://{authority}"));
}
- if let Some(path) = uri.root() {
- if !path.is_empty() {
- let mut segments = path.splitn(3, '/');
- if let Some(db) = segments.next() {
- if !db.is_empty() {
- map.entry("database".to_string())
- .or_insert_with(|| db.to_string());
- }
- }
- if let Some(collection) = segments.next() {
- if !collection.is_empty() {
- map.entry("collection".to_string())
- .or_insert_with(|| collection.to_string());
- }
- }
- if let Some(rest) = segments.next() {
- if !rest.is_empty() {
- map.insert("root".to_string(), rest.to_string());
- }
- }
+ if let Some(path) = uri.root()
+ && !path.is_empty()
+ {
+ let mut segments = path.splitn(3, '/');
+ if let Some(db) = segments.next()
+ && !db.is_empty()
+ {
+ map.entry("database".to_string())
+ .or_insert_with(|| db.to_string());
+ }
+ if let Some(collection) = segments.next()
+ && !collection.is_empty()
+ {
+ map.entry("collection".to_string())
+ .or_insert_with(|| collection.to_string());
+ }
+ if let Some(rest) = segments.next()
+ && !rest.is_empty()
+ {
+ map.insert("root".to_string(), rest.to_string());
}
}
diff --git a/core/services/monoiofs/src/backend.rs
b/core/services/monoiofs/src/backend.rs
index 5bf9cab4d..5359f9b72 100644
--- a/core/services/monoiofs/src/backend.rs
+++ b/core/services/monoiofs/src/backend.rs
@@ -59,15 +59,15 @@ impl Builder for MonoiofsBuilder {
Error::new(ErrorKind::ConfigInvalid, "root is not specified")
.with_operation("Builder::build"),
)?;
- if let Err(e) = std::fs::metadata(&root) {
- if e.kind() == io::ErrorKind::NotFound {
- std::fs::create_dir_all(&root).map_err(|e| {
- Error::new(ErrorKind::Unexpected, "create root dir failed")
- .with_operation("Builder::build")
- .with_context("root", root.to_string_lossy())
- .set_source(e)
- })?;
- }
+ if let Err(e) = std::fs::metadata(&root)
+ && e.kind() == io::ErrorKind::NotFound
+ {
+ std::fs::create_dir_all(&root).map_err(|e| {
+ Error::new(ErrorKind::Unexpected, "create root dir failed")
+ .with_operation("Builder::build")
+ .with_context("root", root.to_string_lossy())
+ .set_source(e)
+ })?;
}
let root = root.canonicalize().map_err(|e| {
Error::new(
diff --git a/core/services/monoiofs/src/config.rs
b/core/services/monoiofs/src/config.rs
index c38da95b8..592aa4e8f 100644
--- a/core/services/monoiofs/src/config.rs
+++ b/core/services/monoiofs/src/config.rs
@@ -40,10 +40,10 @@ impl Configurator for MonoiofsConfig {
fn from_uri(uri: &OperatorUri) -> Result<Self> {
let mut map = uri.options().clone();
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/mysql/src/config.rs
b/core/services/mysql/src/config.rs
index 20992261b..25b807a5d 100644
--- a/core/services/mysql/src/config.rs
+++ b/core/services/mysql/src/config.rs
@@ -72,23 +72,23 @@ impl opendal_core::Configurator for MysqlConfig {
.or_insert_with(|| format!("mysql://{authority}"));
}
- if let Some(path) = uri.root() {
- if !path.is_empty() {
- let (table_segment, rest) = match path.split_once('/') {
- Some((table, remainder)) => (table, Some(remainder)),
- None => (path, None),
- };
-
- if !table_segment.is_empty() {
- map.entry("table".to_string())
- .or_insert_with(|| table_segment.to_string());
- }
-
- if let Some(root) = rest {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
- }
+ if let Some(path) = uri.root()
+ && !path.is_empty()
+ {
+ let (table_segment, rest) = match path.split_once('/') {
+ Some((table, remainder)) => (table, Some(remainder)),
+ None => (path, None),
+ };
+
+ if !table_segment.is_empty() {
+ map.entry("table".to_string())
+ .or_insert_with(|| table_segment.to_string());
+ }
+
+ if let Some(root) = rest
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
}
diff --git a/core/services/onedrive/src/config.rs
b/core/services/onedrive/src/config.rs
index 8b7757722..5979688fd 100644
--- a/core/services/onedrive/src/config.rs
+++ b/core/services/onedrive/src/config.rs
@@ -60,15 +60,15 @@ impl Configurator for OnedriveConfig {
fn from_uri(uri: &OperatorUri) -> Result<Self> {
let mut map = uri.options().clone();
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- let normalized = match root.split_once('/') {
- Some((_, rest)) if !rest.is_empty() => rest.to_string(),
- _ => root.to_string(),
- };
- if !normalized.is_empty() {
- map.insert("root".to_string(), normalized);
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ let normalized = match root.split_once('/') {
+ Some((_, rest)) if !rest.is_empty() => rest.to_string(),
+ _ => root.to_string(),
+ };
+ if !normalized.is_empty() {
+ map.insert("root".to_string(), normalized);
}
}
diff --git a/core/services/pcloud/src/config.rs
b/core/services/pcloud/src/config.rs
index 07b8d22b6..2214d6081 100644
--- a/core/services/pcloud/src/config.rs
+++ b/core/services/pcloud/src/config.rs
@@ -59,10 +59,10 @@ impl Configurator for PcloudConfig {
map.insert("endpoint".to_string(), format!("https://{authority}"));
}
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/pcloud/src/core.rs b/core/services/pcloud/src/core.rs
index 23de49501..9586851d0 100644
--- a/core/services/pcloud/src/core.rs
+++ b/core/services/pcloud/src/core.rs
@@ -99,12 +99,11 @@ impl PcloudCore {
return Err(Error::new(ErrorKind::Unexpected,
format!("{resp:?}")));
}
- if let Some(hosts) = resp.hosts {
- if let Some(path) = resp.path {
- if !hosts.is_empty() {
- return Ok(format!("https://{}{}", hosts[0], path));
- }
- }
+ if let Some(hosts) = resp.hosts
+ && let Some(path) = resp.path
+ && !hosts.is_empty()
+ {
+ return Ok(format!("https://{}{}", hosts[0], path));
}
Err(Error::new(ErrorKind::Unexpected, "hosts is empty"))
}
diff --git a/core/services/persy/src/config.rs
b/core/services/persy/src/config.rs
index 95025681d..53d47b2f5 100644
--- a/core/services/persy/src/config.rs
+++ b/core/services/persy/src/config.rs
@@ -39,11 +39,11 @@ impl opendal_core::Configurator for PersyConfig {
fn from_uri(uri: &opendal_core::OperatorUri) -> opendal_core::Result<Self>
{
let mut map = uri.options().clone();
- if let Some(path) = uri.root() {
- if !path.is_empty() {
- map.entry("datafile".to_string())
- .or_insert_with(|| format!("/{path}"));
- }
+ if let Some(path) = uri.root()
+ && !path.is_empty()
+ {
+ map.entry("datafile".to_string())
+ .or_insert_with(|| format!("/{path}"));
}
Self::from_iter(map)
diff --git a/core/services/postgresql/src/config.rs
b/core/services/postgresql/src/config.rs
index e35fad3b8..d9e5072af 100644
--- a/core/services/postgresql/src/config.rs
+++ b/core/services/postgresql/src/config.rs
@@ -72,23 +72,23 @@ impl opendal_core::Configurator for PostgresqlConfig {
.or_insert_with(|| format!("postgresql://{authority}"));
}
- if let Some(path) = uri.root() {
- if !path.is_empty() {
- let (table_segment, rest) = match path.split_once('/') {
- Some((table, remainder)) => (table, Some(remainder)),
- None => (path, None),
- };
-
- if !table_segment.is_empty() {
- map.entry("table".to_string())
- .or_insert_with(|| table_segment.to_string());
- }
-
- if let Some(root) = rest {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
- }
+ if let Some(path) = uri.root()
+ && !path.is_empty()
+ {
+ let (table_segment, rest) = match path.split_once('/') {
+ Some((table, remainder)) => (table, Some(remainder)),
+ None => (path, None),
+ };
+
+ if !table_segment.is_empty() {
+ map.entry("table".to_string())
+ .or_insert_with(|| table_segment.to_string());
+ }
+
+ if let Some(root) = rest
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
}
diff --git a/core/services/redb/src/config.rs b/core/services/redb/src/config.rs
index 390ac6a1a..313566847 100644
--- a/core/services/redb/src/config.rs
+++ b/core/services/redb/src/config.rs
@@ -39,11 +39,11 @@ impl opendal_core::Configurator for RedbConfig {
fn from_uri(uri: &opendal_core::OperatorUri) -> opendal_core::Result<Self>
{
let mut map = uri.options().clone();
- if let Some(path) = uri.root() {
- if !path.is_empty() {
- map.entry("datadir".to_string())
- .or_insert_with(|| format!("/{path}"));
- }
+ if let Some(path) = uri.root()
+ && !path.is_empty()
+ {
+ map.entry("datadir".to_string())
+ .or_insert_with(|| format!("/{path}"));
}
Self::from_iter(map)
diff --git a/core/services/redis/src/config.rs
b/core/services/redis/src/config.rs
index e5aab2a75..e617be499 100644
--- a/core/services/redis/src/config.rs
+++ b/core/services/redis/src/config.rs
@@ -92,27 +92,27 @@ impl Configurator for RedisConfig {
.with_context("service", REDIS_SCHEME));
}
- if let Some(path) = uri.root() {
- if !path.is_empty() {
- if let Some((first, rest)) = path.split_once('/') {
- if let Ok(db) = first.parse::<i64>() {
- map.insert("db".to_string(), db.to_string());
- if !rest.is_empty() {
- map.insert("root".to_string(), rest.to_string());
- }
- } else {
- let mut root_value = first.to_string();
- if !rest.is_empty() {
- root_value.push('/');
- root_value.push_str(rest);
- }
- map.insert("root".to_string(), root_value);
- }
- } else if let Ok(db) = path.parse::<i64>() {
+ if let Some(path) = uri.root()
+ && !path.is_empty()
+ {
+ if let Some((first, rest)) = path.split_once('/') {
+ if let Ok(db) = first.parse::<i64>() {
map.insert("db".to_string(), db.to_string());
+ if !rest.is_empty() {
+ map.insert("root".to_string(), rest.to_string());
+ }
} else {
- map.insert("root".to_string(), path.to_string());
+ let mut root_value = first.to_string();
+ if !rest.is_empty() {
+ root_value.push('/');
+ root_value.push_str(rest);
+ }
+ map.insert("root".to_string(), root_value);
}
+ } else if let Ok(db) = path.parse::<i64>() {
+ map.insert("db".to_string(), db.to_string());
+ } else {
+ map.insert("root".to_string(), path.to_string());
}
}
diff --git a/core/services/rocksdb/src/config.rs
b/core/services/rocksdb/src/config.rs
index 933735d71..ec5d47e0e 100644
--- a/core/services/rocksdb/src/config.rs
+++ b/core/services/rocksdb/src/config.rs
@@ -40,11 +40,11 @@ impl Configurator for RocksdbConfig {
fn from_uri(uri: &OperatorUri) -> Result<Self> {
let mut map = uri.options().clone();
- if let Some(path) = uri.root() {
- if !path.is_empty() {
- map.entry("datadir".to_string())
- .or_insert_with(|| format!("/{path}"));
- }
+ if let Some(path) = uri.root()
+ && !path.is_empty()
+ {
+ map.entry("datadir".to_string())
+ .or_insert_with(|| format!("/{path}"));
}
Self::from_iter(map)
diff --git a/core/services/seafile/src/config.rs
b/core/services/seafile/src/config.rs
index 837ffa7ed..57e9b85e5 100644
--- a/core/services/seafile/src/config.rs
+++ b/core/services/seafile/src/config.rs
@@ -69,10 +69,10 @@ impl opendal_core::Configurator for SeafileConfig {
map.insert("repo_name".to_string(), repo_name.to_string());
}
- if let Some(rest) = segments.next() {
- if !rest.is_empty() {
- map.insert("root".to_string(), rest.to_string());
- }
+ if let Some(rest) = segments.next()
+ && !rest.is_empty()
+ {
+ map.insert("root".to_string(), rest.to_string());
}
}
diff --git a/core/services/sftp/src/core.rs b/core/services/sftp/src/core.rs
index 418ca43e8..84ec65004 100644
--- a/core/services/sftp/src/core.rs
+++ b/core/services/sftp/src/core.rs
@@ -236,10 +236,10 @@ mod utils {
metadata.set_content_length(size);
}
- if let Some(modified) = meta.modified() {
- if let Ok(m) = Timestamp::try_from(modified.as_system_time()) {
- metadata.set_last_modified(m);
- }
+ if let Some(modified) = meta.modified()
+ && let Ok(m) = Timestamp::try_from(modified.as_system_time())
+ {
+ metadata.set_last_modified(m);
}
metadata
diff --git a/core/services/sled/src/config.rs b/core/services/sled/src/config.rs
index d84396de2..6ea2d662c 100644
--- a/core/services/sled/src/config.rs
+++ b/core/services/sled/src/config.rs
@@ -50,11 +50,11 @@ impl opendal_core::Configurator for SledConfig {
fn from_uri(uri: &opendal_core::OperatorUri) -> opendal_core::Result<Self>
{
let mut map = uri.options().clone();
- if let Some(path) = uri.root() {
- if !path.is_empty() {
- map.entry("datadir".to_string())
- .or_insert_with(|| format!("/{path}"));
- }
+ if let Some(path) = uri.root()
+ && !path.is_empty()
+ {
+ map.entry("datadir".to_string())
+ .or_insert_with(|| format!("/{path}"));
}
Self::from_iter(map)
diff --git a/core/services/sqlite/src/config.rs
b/core/services/sqlite/src/config.rs
index ffafb1837..d08a6046e 100644
--- a/core/services/sqlite/src/config.rs
+++ b/core/services/sqlite/src/config.rs
@@ -78,23 +78,23 @@ impl opendal_core::Configurator for SqliteConfig {
.or_insert_with(|| format!("sqlite://{authority}"));
}
- if let Some(path) = uri.root() {
- if !path.is_empty() {
- let (table, rest) = match path.split_once('/') {
- Some((table, remainder)) => (table, Some(remainder)),
- None => (path, None),
- };
-
- if !table.is_empty() {
- map.entry("table".to_string())
- .or_insert_with(|| table.to_string());
- }
-
- if let Some(root) = rest {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
- }
+ if let Some(path) = uri.root()
+ && !path.is_empty()
+ {
+ let (table, rest) = match path.split_once('/') {
+ Some((table, remainder)) => (table, Some(remainder)),
+ None => (path, None),
+ };
+
+ if !table.is_empty() {
+ map.entry("table".to_string())
+ .or_insert_with(|| table.to_string());
+ }
+
+ if let Some(root) = rest
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
}
diff --git a/core/services/surrealdb/src/config.rs
b/core/services/surrealdb/src/config.rs
index 3c555492f..28dd90a3f 100644
--- a/core/services/surrealdb/src/config.rs
+++ b/core/services/surrealdb/src/config.rs
@@ -72,32 +72,32 @@ impl opendal_core::Configurator for SurrealdbConfig {
.or_insert_with(|| format!("ws://{authority}"));
}
- if let Some(path) = uri.root() {
- if !path.is_empty() {
- let mut segments = path.splitn(4, '/');
- if let Some(namespace) = segments.next() {
- if !namespace.is_empty() {
- map.entry("namespace".to_string())
- .or_insert_with(|| namespace.to_string());
- }
- }
- if let Some(database) = segments.next() {
- if !database.is_empty() {
- map.entry("database".to_string())
- .or_insert_with(|| database.to_string());
- }
- }
- if let Some(table) = segments.next() {
- if !table.is_empty() {
- map.entry("table".to_string())
- .or_insert_with(|| table.to_string());
- }
- }
- if let Some(rest) = segments.next() {
- if !rest.is_empty() {
- map.insert("root".to_string(), rest.to_string());
- }
- }
+ if let Some(path) = uri.root()
+ && !path.is_empty()
+ {
+ let mut segments = path.splitn(4, '/');
+ if let Some(namespace) = segments.next()
+ && !namespace.is_empty()
+ {
+ map.entry("namespace".to_string())
+ .or_insert_with(|| namespace.to_string());
+ }
+ if let Some(database) = segments.next()
+ && !database.is_empty()
+ {
+ map.entry("database".to_string())
+ .or_insert_with(|| database.to_string());
+ }
+ if let Some(table) = segments.next()
+ && !table.is_empty()
+ {
+ map.entry("table".to_string())
+ .or_insert_with(|| table.to_string());
+ }
+ if let Some(rest) = segments.next()
+ && !rest.is_empty()
+ {
+ map.insert("root".to_string(), rest.to_string());
}
}
diff --git a/core/services/tikv/src/config.rs b/core/services/tikv/src/config.rs
index fd432d17e..36786e8d4 100644
--- a/core/services/tikv/src/config.rs
+++ b/core/services/tikv/src/config.rs
@@ -58,10 +58,10 @@ impl opendal_core::Configurator for TikvConfig {
let map = uri.options().clone();
let mut endpoints = Vec::new();
- if let Some(authority) = uri.authority() {
- if !authority.is_empty() {
- endpoints.push(authority.to_string());
- }
+ if let Some(authority) = uri.authority()
+ && !authority.is_empty()
+ {
+ endpoints.push(authority.to_string());
}
if let Some(path) = uri.root() {
diff --git a/core/services/tos/src/core.rs b/core/services/tos/src/core.rs
index 8721113e8..f32066cd3 100644
--- a/core/services/tos/src/core.rs
+++ b/core/services/tos/src/core.rs
@@ -671,11 +671,11 @@ impl TosCore {
if let Some(limit) = limit {
url = url.push("max-keys", &limit.to_string());
}
- if let Some(start_after) = start_after {
- if path.is_empty() || path == "/" || start_after.starts_with(path)
{
- let start_after = build_abs_path(&self.root, &start_after);
- url = url.push("start-after",
&percent_encode_query(&start_after));
- }
+ if let Some(start_after) = start_after
+ && (path.is_empty() || path == "/" ||
start_after.starts_with(path))
+ {
+ let start_after = build_abs_path(&self.root, &start_after);
+ url = url.push("start-after", &percent_encode_query(&start_after));
}
if !continuation_token.is_empty() {
url = url.push(
diff --git a/core/services/vercel-blob/src/config.rs
b/core/services/vercel-blob/src/config.rs
index 57f7c8ce5..b38d070f8 100644
--- a/core/services/vercel-blob/src/config.rs
+++ b/core/services/vercel-blob/src/config.rs
@@ -49,10 +49,10 @@ impl opendal_core::Configurator for VercelBlobConfig {
fn from_uri(uri: &opendal_core::OperatorUri) -> opendal_core::Result<Self>
{
let mut map = uri.options().clone();
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/webdav/src/core.rs b/core/services/webdav/src/core.rs
index 3f07c86c7..085675e0f 100644
--- a/core/services/webdav/src/core.rs
+++ b/core/services/webdav/src/core.rs
@@ -692,13 +692,12 @@ pub fn parse_user_metadata_from_xml(xml: &str,
namespace_uri: &str) -> HashMap<S
if let Some(colon_pos) = name.find(':') {
let prefix = &name[..colon_pos];
let local_name = &name[colon_pos + 1..];
- if target_prefixes.contains(&prefix.to_string()) {
- if let Some(key) = current_prop_key.take() {
- if key == local_name {
- user_metadata.insert(key,
current_prop_value.clone());
- current_prop_value.clear();
- }
- }
+ if target_prefixes.contains(&prefix.to_string())
+ && let Some(key) = current_prop_key.take()
+ && key == local_name
+ {
+ user_metadata.insert(key, current_prop_value.clone());
+ current_prop_value.clear();
}
}
}
@@ -746,15 +745,14 @@ pub fn check_proppatch_response(xml: &str) -> Result<()> {
let name =
String::from_utf8_lossy(e.name().as_ref()).to_lowercase();
if name.ends_with(":status") || name == "status" {
// Parse status code from "HTTP/1.1 XXX Description"
- if let Some(code_str) =
status_text.split_whitespace().nth(1) {
- if let Ok(code) = code_str.parse::<u16>() {
- if !(200..300).contains(&code) {
- return Err(Error::new(
- ErrorKind::Unexpected,
- format!("PROPPATCH failed with status:
{status_text}"),
- ));
- }
- }
+ if let Some(code_str) =
status_text.split_whitespace().nth(1)
+ && let Ok(code) = code_str.parse::<u16>()
+ && !(200..300).contains(&code)
+ {
+ return Err(Error::new(
+ ErrorKind::Unexpected,
+ format!("PROPPATCH failed with status:
{status_text}"),
+ ));
}
in_status = false;
}
diff --git a/core/services/webhdfs/src/config.rs
b/core/services/webhdfs/src/config.rs
index f4024128f..4b65ec13b 100644
--- a/core/services/webhdfs/src/config.rs
+++ b/core/services/webhdfs/src/config.rs
@@ -62,10 +62,10 @@ impl opendal_core::Configurator for WebhdfsConfig {
map.insert("endpoint".to_string(), format!("http://{authority}"));
}
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/services/yandex-disk/src/config.rs
b/core/services/yandex-disk/src/config.rs
index 6957dd0c6..b60522337 100644
--- a/core/services/yandex-disk/src/config.rs
+++ b/core/services/yandex-disk/src/config.rs
@@ -49,10 +49,10 @@ impl opendal_core::Configurator for YandexDiskConfig {
fn from_uri(uri: &opendal_core::OperatorUri) -> opendal_core::Result<Self>
{
let mut map = uri.options().clone();
- if let Some(root) = uri.root() {
- if !root.is_empty() {
- map.insert("root".to_string(), root.to_string());
- }
+ if let Some(root) = uri.root()
+ && !root.is_empty()
+ {
+ map.insert("root".to_string(), root.to_string());
}
Self::from_iter(map)
diff --git a/core/tests/behavior/main.rs b/core/tests/behavior/main.rs
index 59790622f..07ff1053e 100644
--- a/core/tests/behavior/main.rs
+++ b/core/tests/behavior/main.rs
@@ -35,7 +35,7 @@ mod async_write;
use libtest_mimic::Arguments;
use libtest_mimic::Trial;
use logforth::append::Testing;
-use logforth::filter::env_filter::EnvFilterBuilder;
+use logforth::filter::rustlog::RustLogFilterBuilder;
use logforth::layout::TextLayout;
use opendal::tests::TEST_RUNTIME;
use opendal::tests::init_test_service;
@@ -68,7 +68,7 @@ fn main() -> anyhow::Result<()> {
// nextest output
let _ = logforth::starter_log::builder()
.dispatch(|d| {
- d.filter(EnvFilterBuilder::from_default_env().build())
+ d.filter(RustLogFilterBuilder::from_default_env().build())
.append(Testing::default().with_layout(TextLayout::default()))
})
.try_apply();
diff --git a/dev/Cargo.toml b/dev/Cargo.toml
index 5f0256df3..9a8e3192d 100644
--- a/dev/Cargo.toml
+++ b/dev/Cargo.toml
@@ -24,7 +24,7 @@ edition = "2024"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
version = "0.0.1"
[dependencies]
diff --git a/dev/src/generate/parser.rs b/dev/src/generate/parser.rs
index 2cf13d28b..f46eaf697 100644
--- a/dev/src/generate/parser.rs
+++ b/dev/src/generate/parser.rs
@@ -183,10 +183,10 @@ fn collect_custom_type_names(items: &[Item]) ->
HashSet<String> {
let mut names = HashSet::new();
for item in items {
- if let Item::Use(item_use) = item {
- if let Some(name) = extract_name(&item_use.tree) {
- names.insert(name);
- }
+ if let Item::Use(item_use) = item
+ && let Some(name) = extract_name(&item_use.tree)
+ {
+ names.insert(name);
}
}
names
@@ -262,10 +262,10 @@ impl ServiceParser {
.items
.iter()
.find_map(|v| {
- if let Item::Struct(v) = v {
- if v.ident.to_string().contains("Config") {
- return Some(v.clone());
- }
+ if let Item::Struct(v) = v
+ && v.ident.to_string().contains("Config")
+ {
+ return Some(v.clone());
}
None
})
@@ -354,13 +354,12 @@ impl ServiceParser {
.iter()
.filter(|attr| attr.path().is_ident("doc"))
.filter_map(|attr| {
- if let Meta::NameValue(meta) = &attr.meta {
- if let Expr::Lit(ExprLit {
+ if let Meta::NameValue(meta) = &attr.meta
+ && let Expr::Lit(ExprLit {
lit: Lit::Str(s), ..
}) = &meta.value
- {
- return Some(s.value().trim().to_string());
- }
+ {
+ return Some(s.value().trim().to_string());
}
None
diff --git a/integrations/dav-server/Cargo.toml
b/integrations/dav-server/Cargo.toml
index b3e8a8677..8b9cb89d0 100644
--- a/integrations/dav-server/Cargo.toml
+++ b/integrations/dav-server/Cargo.toml
@@ -25,7 +25,7 @@ edition = "2024"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
[dependencies]
anyhow = "1"
diff --git a/integrations/object_store/Cargo.toml
b/integrations/object_store/Cargo.toml
index 3f3514cbc..0aad073ff 100644
--- a/integrations/object_store/Cargo.toml
+++ b/integrations/object_store/Cargo.toml
@@ -24,7 +24,7 @@ edition = "2024"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
version = "0.57.0"
[features]
diff --git a/integrations/parquet/Cargo.toml b/integrations/parquet/Cargo.toml
index 6f1b9b7c6..0232bf0ae 100644
--- a/integrations/parquet/Cargo.toml
+++ b/integrations/parquet/Cargo.toml
@@ -24,7 +24,7 @@ edition = "2024"
homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
version = "0.8.1"
[dependencies]
diff --git a/integrations/unftp-sbe/Cargo.toml
b/integrations/unftp-sbe/Cargo.toml
index c2daf4e93..564c30163 100644
--- a/integrations/unftp-sbe/Cargo.toml
+++ b/integrations/unftp-sbe/Cargo.toml
@@ -23,7 +23,7 @@ homepage = "https://opendal.apache.org/"
license = "Apache-2.0"
name = "unftp-sbe-opendal"
repository = "https://github.com/apache/opendal"
-rust-version = "1.85"
+rust-version = "1.91"
version = "0.4.2"
[dependencies]