Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Centralize Rust edition and lint policy

Manav Rathi2dbad65b31c4
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index cd51b08990..568f5f79e8 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -41,6 +41,9 @@ members = [
"crates/test-support",
]
+[workspace.package]
+edition = "2024"
+
[workspace.dependencies]
dirs = "5.0.1"
ente-accounts = { path = "crates/accounts" }
@@ -105,6 +108,13 @@ wasm-bindgen-futures = "0.4.75"
zeroize = { version = "1.9.0", features = ["derive"] }
zip = { version = "8.6.0", default-features = false, features = ["deflate-flate2-zlib-rs"] }
+[workspace.lints.rust]
+unexpected_cfgs = { level = "warn", check-cfg = ['cfg(frb_expand)'] }
+
+[workspace.lints.clippy]
+allow_attributes = "deny"
+allow_attributes_without_reason = "deny"
+
# Unoptimized Argon2 makes production-strength derivations dominate test runtime.
[profile.dev.package.argon2]
opt-level = 3
diff --git a/rust/apps/cli/Cargo.toml b/rust/apps/cli/Cargo.toml
index 44f1471ac5..1a06708838 100644
--- a/rust/apps/cli/Cargo.toml
+++ b/rust/apps/cli/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "ente-rs"
version = "0.0.1"
-edition = "2024"
+edition.workspace = true
description = "Command-line interface for Ente"
homepage = "https://ente.com"
repository = "https://github.com/ente/ente"
@@ -39,3 +39,6 @@ mockito.workspace = true
sha2.workspace = true
srp.workspace = true
url.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/apps/cli/tests/support/cli.rs b/rust/apps/cli/tests/support/cli.rs
index 9716609def..4955d08339 100644
--- a/rust/apps/cli/tests/support/cli.rs
+++ b/rust/apps/cli/tests/support/cli.rs
@@ -1,6 +1,3 @@
-// Each integration test compiles this shared support module separately.
-#![allow(dead_code)]
-
use std::{
io::Write,
path::{Path, PathBuf},
diff --git a/rust/apps/cli/tests/sync.rs b/rust/apps/cli/tests/sync.rs
index cd46ad4844..06189c3112 100644
--- a/rust/apps/cli/tests/sync.rs
+++ b/rust/apps/cli/tests/sync.rs
@@ -1,5 +1,9 @@
#![cfg(feature = "museum")]
+#[expect(
+ dead_code,
+ reason = "Sync tests use only part of the shared CLI helpers"
+)]
mod support;
use ente_test_support::HARDCODED_OTT;
diff --git a/rust/apps/codegen/Cargo.toml b/rust/apps/codegen/Cargo.toml
index f310be4fab..4c5b24c366 100644
--- a/rust/apps/codegen/Cargo.toml
+++ b/rust/apps/codegen/Cargo.toml
@@ -1,8 +1,11 @@
[package]
name = "codegen"
-edition = "2024"
+edition.workspace = true
[dependencies]
camino = "=1.2.2"
flutter_rust_bridge_codegen.workspace = true
uniffi_bindgen.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/apps/ensu/src-tauri/Cargo.toml b/rust/apps/ensu/src-tauri/Cargo.toml
index 1078a15f12..2888d55e20 100644
--- a/rust/apps/ensu/src-tauri/Cargo.toml
+++ b/rust/apps/ensu/src-tauri/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "ensu-desktop"
version = "0.1.20-beta"
-edition = "2024"
+edition.workspace = true
[build-dependencies]
tauri-build = { version = "2.6.2", features = [] }
@@ -32,3 +32,6 @@ windows-sys = { version = "0.61.2", features = ["Win32_Foundation", "Win32_Stora
[features]
custom-protocol = ["tauri/custom-protocol"]
+
+[lints]
+workspace = true
diff --git a/rust/bindings/frb/lib/Cargo.toml b/rust/bindings/frb/lib/Cargo.toml
index 3ba8deffa3..2f0a2e2ac5 100644
--- a/rust/bindings/frb/lib/Cargo.toml
+++ b/rust/bindings/frb/lib/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-frb-lib"
-edition = "2024"
+edition.workspace = true
[features]
contacts = ["dep:ente-contacts"]
@@ -12,5 +12,5 @@ ente-core.workspace = true
ente-legacy = { workspace = true, optional = true }
flutter_rust_bridge.workspace = true
-[lints.rust]
-unexpected_cfgs = { level = "warn", check-cfg = ['cfg(frb_expand)'] }
+[lints]
+workspace = true
diff --git a/rust/bindings/frb/locker/Cargo.toml b/rust/bindings/frb/locker/Cargo.toml
index 883346d825..44a8321ad2 100644
--- a/rust/bindings/frb/locker/Cargo.toml
+++ b/rust/bindings/frb/locker/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-locker-frb"
-edition = "2024"
+edition.workspace = true
[lib]
crate-type = ["cdylib", "staticlib"]
@@ -15,8 +15,8 @@ ente-legacy.workspace = true
ente-ml.workspace = true
flutter_rust_bridge.workspace = true
-[lints.rust]
-unexpected_cfgs = { level = "warn", check-cfg = ['cfg(frb_expand)'] }
+[lints]
+workspace = true
[features]
default = []
diff --git a/rust/bindings/frb/log/Cargo.toml b/rust/bindings/frb/log/Cargo.toml
index 185ab7b998..f2dff4e545 100644
--- a/rust/bindings/frb/log/Cargo.toml
+++ b/rust/bindings/frb/log/Cargo.toml
@@ -1,7 +1,10 @@
[package]
name = "ente-frb-log"
-edition = "2024"
+edition.workspace = true
[dependencies]
flutter_rust_bridge.workspace = true
log.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/bindings/frb/photos/Cargo.toml b/rust/bindings/frb/photos/Cargo.toml
index 8745430c33..a9d853ef89 100644
--- a/rust/bindings/frb/photos/Cargo.toml
+++ b/rust/bindings/frb/photos/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-photos-frb"
-edition = "2024"
+edition.workspace = true
[lib]
crate-type = ["cdylib", "staticlib"]
@@ -18,8 +18,8 @@ ente-photos.workspace = true
flutter_rust_bridge.workspace = true
log.workspace = true
-[lints.rust]
-unexpected_cfgs = { level = "warn", check-cfg = ['cfg(frb_expand)'] }
+[lints]
+workspace = true
[features]
default = []
diff --git a/rust/bindings/napi/photos/Cargo.toml b/rust/bindings/napi/photos/Cargo.toml
index 4e4fd37e20..8071bdc300 100644
--- a/rust/bindings/napi/photos/Cargo.toml
+++ b/rust/bindings/napi/photos/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-photos-napi"
-edition = "2024"
+edition.workspace = true
[lib]
crate-type = ["cdylib"]
@@ -16,3 +16,6 @@ ort = { workspace = true, features = ["load-dynamic"] }
[build-dependencies]
napi-build = "2.0.0"
+
+[lints]
+workspace = true
diff --git a/rust/bindings/uniffi/cast/Cargo.toml b/rust/bindings/uniffi/cast/Cargo.toml
index 02e018e044..f2e1fd1c79 100644
--- a/rust/bindings/uniffi/cast/Cargo.toml
+++ b/rust/bindings/uniffi/cast/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-cast-uniffi"
-edition = "2024"
+edition.workspace = true
[lib]
name = "cast"
@@ -12,3 +12,6 @@ ente-core.workspace = true
ente-uniffi-log.workspace = true
thiserror.workspace = true
uniffi.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/bindings/uniffi/ensu/Cargo.toml b/rust/bindings/uniffi/ensu/Cargo.toml
index c285583019..ac2fedfce1 100644
--- a/rust/bindings/uniffi/ensu/Cargo.toml
+++ b/rust/bindings/uniffi/ensu/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-ensu-uniffi"
-edition = "2024"
+edition.workspace = true
[lib]
name = "ensu"
@@ -14,3 +14,6 @@ ente-uniffi-log.workspace = true
thiserror.workspace = true
uniffi = { workspace = true, features = ["tokio"] }
uuid.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/bindings/uniffi/log/Cargo.toml b/rust/bindings/uniffi/log/Cargo.toml
index bf656b8cde..01985bc9df 100644
--- a/rust/bindings/uniffi/log/Cargo.toml
+++ b/rust/bindings/uniffi/log/Cargo.toml
@@ -1,6 +1,9 @@
[package]
name = "ente-uniffi-log"
-edition = "2024"
+edition.workspace = true
[dependencies]
log = { workspace = true, features = ["std"] }
+
+[lints]
+workspace = true
diff --git a/rust/bindings/wasm/cast/Cargo.toml b/rust/bindings/wasm/cast/Cargo.toml
index 2fab2fb806..5470311f92 100644
--- a/rust/bindings/wasm/cast/Cargo.toml
+++ b/rust/bindings/wasm/cast/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-cast-wasm"
-edition = "2024"
+edition.workspace = true
[lib]
crate-type = ["cdylib"]
@@ -12,3 +12,6 @@ ente-wasm-lib.workspace = true
js-sys.workspace = true
thiserror.workspace = true
wasm-bindgen.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/bindings/wasm/ensu/Cargo.toml b/rust/bindings/wasm/ensu/Cargo.toml
index 52d9790ec0..87c856ecc4 100644
--- a/rust/bindings/wasm/ensu/Cargo.toml
+++ b/rust/bindings/wasm/ensu/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-ensu-wasm"
-edition = "2024"
+edition.workspace = true
[lib]
crate-type = ["cdylib"]
@@ -12,3 +12,6 @@ ente-wasm-lib.workspace = true
js-sys.workspace = true
thiserror.workspace = true
wasm-bindgen.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/bindings/wasm/legacy/Cargo.toml b/rust/bindings/wasm/legacy/Cargo.toml
index 841d46fdb4..9b01048cc3 100644
--- a/rust/bindings/wasm/legacy/Cargo.toml
+++ b/rust/bindings/wasm/legacy/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-legacy-wasm"
-edition = "2024"
+edition.workspace = true
[lib]
crate-type = ["cdylib"]
@@ -17,3 +17,6 @@ thiserror.workspace = true
tsify.workspace = true
wasm-bindgen.workspace = true
wasm-bindgen-futures.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/bindings/wasm/lib/Cargo.toml b/rust/bindings/wasm/lib/Cargo.toml
index 5e49177848..9400ce4bee 100644
--- a/rust/bindings/wasm/lib/Cargo.toml
+++ b/rust/bindings/wasm/lib/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-wasm-lib"
-edition = "2024"
+edition.workspace = true
[features]
accounts = ["dep:ente-accounts"]
@@ -31,3 +31,6 @@ tsify = { workspace = true, optional = true }
wasm-bindgen.workspace = true
wasm-bindgen-futures = { workspace = true, optional = true }
web-sys = { version = "0.3.102", features = ["console"] }
+
+[lints]
+workspace = true
diff --git a/rust/bindings/wasm/locker/Cargo.toml b/rust/bindings/wasm/locker/Cargo.toml
index 987926427d..9ccd8d1b06 100644
--- a/rust/bindings/wasm/locker/Cargo.toml
+++ b/rust/bindings/wasm/locker/Cargo.toml
@@ -1,9 +1,12 @@
[package]
name = "ente-locker-wasm"
-edition = "2024"
+edition.workspace = true
[lib]
crate-type = ["cdylib"]
[dependencies]
ente-wasm-lib = { workspace = true, features = ["accounts", "collections", "contacts", "crypto-file", "crypto-seal"] }
+
+[lints]
+workspace = true
diff --git a/rust/bindings/wasm/paste/Cargo.toml b/rust/bindings/wasm/paste/Cargo.toml
index 4981866987..07516ab2f1 100644
--- a/rust/bindings/wasm/paste/Cargo.toml
+++ b/rust/bindings/wasm/paste/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-paste-wasm"
-edition = "2024"
+edition.workspace = true
[lib]
crate-type = ["cdylib"]
@@ -13,3 +13,6 @@ js-sys.workspace = true
thiserror.workspace = true
wasm-bindgen.workspace = true
wasm-bindgen-futures.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/bindings/wasm/photos/Cargo.toml b/rust/bindings/wasm/photos/Cargo.toml
index 8e6841985f..ea1bdad800 100644
--- a/rust/bindings/wasm/photos/Cargo.toml
+++ b/rust/bindings/wasm/photos/Cargo.toml
@@ -1,9 +1,12 @@
[package]
name = "ente-photos-wasm"
-edition = "2024"
+edition.workspace = true
[lib]
crate-type = ["cdylib"]
[dependencies]
ente-wasm-lib = { workspace = true, features = ["collections", "contacts"] }
+
+[lints]
+workspace = true
diff --git a/rust/bindings/wasm/prelogin/Cargo.toml b/rust/bindings/wasm/prelogin/Cargo.toml
index d67128e54c..4d55783074 100644
--- a/rust/bindings/wasm/prelogin/Cargo.toml
+++ b/rust/bindings/wasm/prelogin/Cargo.toml
@@ -1,9 +1,12 @@
[package]
name = "ente-prelogin-wasm"
-edition = "2024"
+edition.workspace = true
[lib]
crate-type = ["cdylib"]
[dependencies]
ente-wasm-lib = { workspace = true, features = ["prelogin"] }
+
+[lints]
+workspace = true
diff --git a/rust/bindings/wasm/space/Cargo.toml b/rust/bindings/wasm/space/Cargo.toml
index 924fe5e38d..ce4be1f593 100644
--- a/rust/bindings/wasm/space/Cargo.toml
+++ b/rust/bindings/wasm/space/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-space-wasm"
-edition = "2024"
+edition.workspace = true
[lib]
crate-type = ["cdylib"]
@@ -19,3 +19,6 @@ wasm-bindgen-futures.workspace = true
[dev-dependencies]
tokio = { workspace = true, features = ["macros", "rt"] }
+
+[lints]
+workspace = true
diff --git a/rust/checks/cargo-workspace-dependencies/check.py b/rust/checks/cargo-workspace-dependencies/check.py
index e3d1b90cfa..09597de5a8 100644
--- a/rust/checks/cargo-workspace-dependencies/check.py
+++ b/rust/checks/cargo-workspace-dependencies/check.py
@@ -45,6 +45,12 @@ for package in packages:
manifest = Path(package["manifest_path"])
path = manifest.relative_to(root).as_posix()
cargo = tomllib.loads(manifest.read_text())
+ if cargo["package"].get("edition") != {"workspace": True}:
+ print(f"{path}: use edition.workspace = true", file=sys.stderr)
+ failed = True
+ if cargo.get("lints") != {"workspace": True}:
+ print(f"{path}: use [lints] workspace = true", file=sys.stderr)
+ failed = True
tables = [(section, cargo.get(section, {})) for section in sections]
tables += [
(f"target.{target}.{section}", config.get(section, {}))
diff --git a/rust/checks/cargo-workspace-dependencies/test.py b/rust/checks/cargo-workspace-dependencies/test.py
index f76acb70f1..eb047848f0 100644
--- a/rust/checks/cargo-workspace-dependencies/test.py
+++ b/rust/checks/cargo-workspace-dependencies/test.py
@@ -10,19 +10,29 @@ members = ["app-*"]
exclude = ["app-excluded"]
resolver = "2"
+[workspace.package]
+edition = "2024"
+
[workspace.dependencies]
shared = { path = "shared" }
serde = "1.0.0"
+
+[workspace.lints.clippy]
+allow_attributes = "deny"
+allow_attributes_without_reason = "deny"
"""
package = """\
[package]
name = "{}"
version = "0.1.0"
-edition = "2024"
+edition.workspace = true
+
+[lints]
+workspace = true
"""
-def run(app_b, members='"app-*"'):
+def run(app_b, members='"app-*"', app_b_package=package):
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
rust = root / "rust"
@@ -32,10 +42,10 @@ def run(app_b, members='"app-*"'):
package.format("app-a")
+ "\n[dependencies]\nshared.workspace = true\nserde.workspace = true\n",
)
- write(rust / "app-b/Cargo.toml", package.format("app-b") + app_b)
+ write(rust / "app-b/Cargo.toml", app_b_package.format("app-b") + app_b)
write(
rust / "app-excluded/Cargo.toml",
- package.format("app-excluded")
+ '[package]\nname = "app-excluded"\nversion = "0.1.0"\nedition = "2024"\n'
+ '\n[dependencies]\nsolo = { path = "../solo" }\n',
)
write(rust / "shared/Cargo.toml", package.format("shared"))
@@ -98,3 +108,11 @@ assert "rust/Cargo.toml: workspace.members 'app-b' precedes 'app-a'; sort member
result = run("\n[dependencies]\nshared.workspace = true\n", '"app-a", "app-b"')
assert result.returncode == 0, result.stderr
assert not result.stderr
+
+result = run("", app_b_package=package.replace('edition.workspace = true', 'edition = "2024"'))
+assert result.returncode == 1, result.stderr
+assert "rust/app-b/Cargo.toml: use edition.workspace = true" in result.stderr
+
+result = run("", app_b_package=package.replace("\n[lints]\nworkspace = true\n", ""))
+assert result.returncode == 1, result.stderr
+assert "rust/app-b/Cargo.toml: use [lints] workspace = true" in result.stderr
diff --git a/rust/crates/accounts/Cargo.toml b/rust/crates/accounts/Cargo.toml
index 279a108f4f..fddd35c7fc 100644
--- a/rust/crates/accounts/Cargo.toml
+++ b/rust/crates/accounts/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-accounts"
-edition = "2024"
+edition.workspace = true
[features]
museum = []
@@ -26,3 +26,6 @@ hmac.workspace = true
mockito.workspace = true
sha1.workspace = true
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] }
+
+[lints]
+workspace = true
diff --git a/rust/crates/accounts/src/flow.rs b/rust/crates/accounts/src/flow.rs
index e50864e775..4dd406ddce 100644
--- a/rust/crates/accounts/src/flow.rs
+++ b/rust/crates/accounts/src/flow.rs
@@ -155,7 +155,10 @@ impl fmt::Debug for CheckSessionValidityParams {
}
#[derive(Debug)]
-#[expect(clippy::large_enum_variant)]
+#[expect(
+ clippy::large_enum_variant,
+ reason = "A single session-check result does not need a separate allocation"
+)]
pub enum SessionValidity {
Invalid,
Valid,
diff --git a/rust/crates/assets/Cargo.toml b/rust/crates/assets/Cargo.toml
index cff81ded09..289e26d650 100644
--- a/rust/crates/assets/Cargo.toml
+++ b/rust/crates/assets/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-assets"
-edition = "2024"
+edition.workspace = true
[dependencies]
flate2.workspace = true
@@ -12,3 +12,6 @@ sha2.workspace = true
tar.workspace = true
thiserror.workspace = true
tokio = { workspace = true, features = ["macros", "rt", "sync"] }
+
+[lints]
+workspace = true
diff --git a/rust/crates/cast/Cargo.toml b/rust/crates/cast/Cargo.toml
index 1edcfc6e31..a815dc51e4 100644
--- a/rust/crates/cast/Cargo.toml
+++ b/rust/crates/cast/Cargo.toml
@@ -1,9 +1,12 @@
[package]
name = "ente-cast"
-edition = "2024"
+edition.workspace = true
[dependencies]
ente-core.workspace = true
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/crates/collections/Cargo.toml b/rust/crates/collections/Cargo.toml
index dc6b6b94bb..cc24b50c20 100644
--- a/rust/crates/collections/Cargo.toml
+++ b/rust/crates/collections/Cargo.toml
@@ -1,7 +1,10 @@
[package]
name = "ente-collections"
-edition = "2024"
+edition.workspace = true
[dependencies]
ente-core.workspace = true
thiserror.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/crates/contacts/Cargo.toml b/rust/crates/contacts/Cargo.toml
index f0aea8372b..470ccb696e 100644
--- a/rust/crates/contacts/Cargo.toml
+++ b/rust/crates/contacts/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-contacts"
-edition = "2024"
+edition.workspace = true
[features]
museum = []
@@ -23,3 +23,6 @@ sha1.workspace = true
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "time"] }
uuid = { workspace = true, features = ["v4", "js"] }
zeroize.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/crates/core/Cargo.toml b/rust/crates/core/Cargo.toml
index 02a1b5cf60..7715750f78 100644
--- a/rust/crates/core/Cargo.toml
+++ b/rust/crates/core/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-core"
-edition = "2024"
+edition.workspace = true
[dependencies]
# Keep argon2 on stable 0.5.x for now. This retains a second digest 0.10
@@ -39,3 +39,6 @@ gloo-timers = { version = "0.3.0", features = ["futures"] }
[dev-dependencies]
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
mockito.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/crates/ensu-crypto/Cargo.toml b/rust/crates/ensu-crypto/Cargo.toml
index 6575cc9075..8973929eea 100644
--- a/rust/crates/ensu-crypto/Cargo.toml
+++ b/rust/crates/ensu-crypto/Cargo.toml
@@ -1,9 +1,12 @@
[package]
name = "ente-ensu-crypto"
-edition = "2024"
+edition.workspace = true
[dependencies]
ente-core.workspace = true
hkdf.workspace = true
sha2.workspace = true
thiserror.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/crates/ensu/Cargo.toml b/rust/crates/ensu/Cargo.toml
index 1f0501288f..2ed7d2bd73 100644
--- a/rust/crates/ensu/Cargo.toml
+++ b/rust/crates/ensu/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-ensu"
-edition = "2024"
+edition.workspace = true
[dependencies]
ente-assets.workspace = true
@@ -58,3 +58,6 @@ transcription = [
"dep:rubato",
"dep:transcribe-rs",
]
+
+[lints]
+workspace = true
diff --git a/rust/crates/exif/Cargo.toml b/rust/crates/exif/Cargo.toml
index 6f83077ac1..bb3efe281a 100644
--- a/rust/crates/exif/Cargo.toml
+++ b/rust/crates/exif/Cargo.toml
@@ -1,9 +1,12 @@
[package]
name = "ente-exif"
-edition = "2024"
+edition.workspace = true
[dependencies]
brotli-decompressor = "5.0.0"
miniz_oxide = "0.8.9"
quick-xml.workspace = true
serde_json.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/crates/image/Cargo.toml b/rust/crates/image/Cargo.toml
index 819dfbc518..4259206052 100644
--- a/rust/crates/image/Cargo.toml
+++ b/rust/crates/image/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-image"
-edition = "2024"
+edition.workspace = true
[dependencies]
ente_heic = { package = "heic_decoder", git = "https://github.com/ente/heic-decoder.git", rev = "2017f4ddaf91017483f6eb71500f520fba47391a", features = [
@@ -13,3 +13,6 @@ kamadak-exif = "0.6.1"
moxcms = { version = "0.8.1", features = ["in_place"] }
thiserror.workspace = true
tiff = "0.10.3"
+
+[lints]
+workspace = true
diff --git a/rust/crates/legacy/Cargo.toml b/rust/crates/legacy/Cargo.toml
index d5c8a2772d..78d8fe35db 100644
--- a/rust/crates/legacy/Cargo.toml
+++ b/rust/crates/legacy/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-legacy"
-edition = "2024"
+edition.workspace = true
[dependencies]
ente-accounts.workspace = true
@@ -10,3 +10,6 @@ serde_json.workspace = true
sha2.workspace = true
thiserror.workspace = true
uuid = { workspace = true, features = ["v4", "js"] }
+
+[lints]
+workspace = true
diff --git a/rust/crates/location-dataset/Cargo.toml b/rust/crates/location-dataset/Cargo.toml
index 5fc115e763..16e983dd18 100644
--- a/rust/crates/location-dataset/Cargo.toml
+++ b/rust/crates/location-dataset/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-location-dataset"
-edition = "2024"
+edition.workspace = true
publish = false
[dependencies]
@@ -12,3 +12,6 @@ sha2.workspace = true
shapefile = { version = "0.9.0", features = ["geo-types"] }
thiserror.workspace = true
zip.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/crates/location/Cargo.toml b/rust/crates/location/Cargo.toml
index 9789550643..5bbec5b652 100644
--- a/rust/crates/location/Cargo.toml
+++ b/rust/crates/location/Cargo.toml
@@ -1,7 +1,10 @@
[package]
name = "ente-location"
-edition = "2024"
+edition.workspace = true
[dependencies]
thiserror.workspace = true
unicode-normalization = "0.1.25"
+
+[lints]
+workspace = true
diff --git a/rust/crates/ml/Cargo.toml b/rust/crates/ml/Cargo.toml
index 8aa713f6f0..f4310e2093 100644
--- a/rust/crates/ml/Cargo.toml
+++ b/rust/crates/ml/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-ml"
-edition = "2024"
+edition.workspace = true
[features]
default = []
@@ -86,3 +86,6 @@ tar.workspace = true
tempfile.workspace = true
tokio = { workspace = true, features = ["macros", "rt"] }
url.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/crates/ml/examples/ml_goldens.rs b/rust/crates/ml/examples/ml_goldens.rs
index 1522557207..7ec26803d2 100644
--- a/rust/crates/ml/examples/ml_goldens.rs
+++ b/rust/crates/ml/examples/ml_goldens.rs
@@ -1,4 +1,7 @@
-#[allow(dead_code)]
+#[expect(
+ dead_code,
+ reason = "Golden generation uses only part of the shared ML helpers"
+)]
#[path = "../tests/support/mod.rs"]
mod support;
diff --git a/rust/crates/ml/examples/ocr.rs b/rust/crates/ml/examples/ocr.rs
index a109eeb590..284c09915c 100644
--- a/rust/crates/ml/examples/ocr.rs
+++ b/rust/crates/ml/examples/ocr.rs
@@ -1,4 +1,4 @@
-#[allow(dead_code)]
+#[expect(dead_code, reason = "OCR uses only part of the shared ML helpers")]
#[path = "../tests/support/mod.rs"]
mod support;
diff --git a/rust/crates/ml/src/onnx/providers.rs b/rust/crates/ml/src/onnx/providers.rs
index 67704c5cf3..4f156f3d80 100644
--- a/rust/crates/ml/src/onnx/providers.rs
+++ b/rust/crates/ml/src/onnx/providers.rs
@@ -55,10 +55,13 @@ pub(crate) enum ExecutionMode {
// Identifies the successful attempt's preferred provider, not its registered
// fallback providers, for result attribution.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
-#[allow(dead_code)] // Accelerated variants are constructed only on their target OS.
pub(super) enum ExecutionProvider {
CoreMl,
WebGpu,
+ #[cfg_attr(
+ not(any(test, target_os = "android")),
+ expect(dead_code, reason = "XNNPACK is only selected on Android")
+ )]
Xnnpack,
Cpu,
}
diff --git a/rust/crates/ml/tests/ml_indexing.rs b/rust/crates/ml/tests/ml_indexing.rs
index d14b1419a6..5721007789 100644
--- a/rust/crates/ml/tests/ml_indexing.rs
+++ b/rust/crates/ml/tests/ml_indexing.rs
@@ -1,5 +1,9 @@
#![cfg(feature = "ml-assets")]
+#[expect(
+ dead_code,
+ reason = "Indexing tests do not use the golden-generation and OCR helpers"
+)]
mod support;
use anyhow::Result;
diff --git a/rust/crates/ml/tests/support/ml_indexing.rs b/rust/crates/ml/tests/support/ml_indexing.rs
index 1c77338c0e..4aef96cb7f 100644
--- a/rust/crates/ml/tests/support/ml_indexing.rs
+++ b/rust/crates/ml/tests/support/ml_indexing.rs
@@ -388,13 +388,11 @@ impl MlIndexingTestContext {
}
}
-#[allow(dead_code)]
pub(crate) struct GoldenModelAsset {
pub(crate) path: PathBuf,
pub(crate) sha256: String,
}
-#[allow(dead_code)]
pub(crate) struct GoldenTestAssets {
pub(crate) face_detection: GoldenModelAsset,
pub(crate) face_embedding: GoldenModelAsset,
@@ -403,7 +401,6 @@ pub(crate) struct GoldenTestAssets {
pub(crate) clip_text_vocab: PathBuf,
}
-#[allow(dead_code)]
impl GoldenTestAssets {
pub(crate) async fn load() -> Result<Self> {
let repo_root = repo_root()?;
@@ -487,9 +484,7 @@ struct ModelAssets {
face_detection: ModelAsset,
face_embedding: ModelAsset,
clip_image: ModelAsset,
- #[allow(dead_code)]
clip_text: ModelAsset,
- #[allow(dead_code)]
clip_text_vocab: ModelAsset,
}
@@ -547,7 +542,6 @@ struct ComparableFace {
embedding: Vec<f64>,
}
-#[allow(dead_code)]
pub(crate) async fn load_onnx_runtime() -> Result<()> {
let repo_root = repo_root()?;
let asset_lock = load_asset_lock(&repo_root)?;
@@ -555,7 +549,6 @@ pub(crate) async fn load_onnx_runtime() -> Result<()> {
init_onnx_runtime(&store, &asset_lock).await
}
-#[allow(dead_code)]
pub(crate) fn asset_cache_dir() -> Result<PathBuf> {
Ok(cache_dir(&repo_root()?))
}
diff --git a/rust/crates/paste/Cargo.toml b/rust/crates/paste/Cargo.toml
index 0a300e6bf0..1bd1d06d4b 100644
--- a/rust/crates/paste/Cargo.toml
+++ b/rust/crates/paste/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-paste"
-edition = "2024"
+edition.workspace = true
[dependencies]
ente-core.workspace = true
@@ -12,3 +12,6 @@ url.workspace = true
mockito.workspace = true
serde_json.workspace = true
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
+
+[lints]
+workspace = true
diff --git a/rust/crates/photos/Cargo.toml b/rust/crates/photos/Cargo.toml
index 2bc90c4bf8..29dc31b222 100644
--- a/rust/crates/photos/Cargo.toml
+++ b/rust/crates/photos/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-photos"
-edition = "2024"
+edition.workspace = true
[dependencies]
ente-assets.workspace = true
@@ -10,3 +10,6 @@ thiserror.workspace = true
[dev-dependencies]
tempfile.workspace = true
+
+[lints]
+workspace = true
diff --git a/rust/crates/space/Cargo.toml b/rust/crates/space/Cargo.toml
index f0d38a9d7d..b900aa6178 100644
--- a/rust/crates/space/Cargo.toml
+++ b/rust/crates/space/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "ente-space"
version = "0.0.1"
-edition = "2024"
+edition.workspace = true
[features]
museum = []
@@ -24,3 +24,6 @@ mockito.workspace = true
reqwest = { workspace = true, features = ["json"] }
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
uuid = { workspace = true, features = ["v4"] }
+
+[lints]
+workspace = true
diff --git a/rust/crates/test-support/Cargo.toml b/rust/crates/test-support/Cargo.toml
index 998397343f..563004f9dc 100644
--- a/rust/crates/test-support/Cargo.toml
+++ b/rust/crates/test-support/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ente-test-support"
-edition = "2024"
+edition.workspace = true
description = "Runs a local Museum backed by a temporary Postgres for integration tests"
publish = false
@@ -9,3 +9,6 @@ dirs.workspace = true
postgresql_embedded = { version = "0.20.4", default-features = false, features = ["blocking", "rustls", "theseus"] }
tokio = { workspace = true, features = ["rt-multi-thread"] }
uuid = { workspace = true, features = ["v4"] }
+
+[lints]
+workspace = true