From 1fa03291f3b071995c09eb067f5504c63bd31538 Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Mon, 30 Nov 2026 18:13:46 +0800 Subject: [PATCH] chore(clippy): scope crate lint policy Keep panic-on-error lints at application target roots and scope signal dependencies to Linux. --- Cargo.toml | 2 -- crates/.clippy.toml | 5 +++++ crates/clash-verge-signal/Cargo.toml | 2 +- src-tauri/build.rs | 2 ++ src-tauri/examples/frontend-contract.rs | 2 ++ src-tauri/src/lib.rs | 1 + src-tauri/src/main.rs | 1 + 7 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 crates/.clippy.toml diff --git a/Cargo.toml b/Cargo.toml index 71857be3f..8efb47932 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -124,7 +124,6 @@ copy_iterator = "deny" correctness = { level = "deny", priority = -1 } dbg_macro = "warn" equatable_if_let = "deny" -expect_used = "warn" expl_impl_clone_on_copy = "deny" future_not_send = "deny" iter_on_empty_collections = "deny" @@ -163,7 +162,6 @@ unnecessary_self_imports = "deny" unnecessary_wraps = "deny" unused_async = "deny" unused_trait_names = "deny" -unwrap_used = "warn" use_self = "deny" useless_let_if_seq = "deny" wildcard_imports = "deny" diff --git a/crates/.clippy.toml b/crates/.clippy.toml new file mode 100644 index 000000000..6853f759c --- /dev/null +++ b/crates/.clippy.toml @@ -0,0 +1,5 @@ +# Clippy loads a single configuration file, so repeat the workspace defaults. +avoid-breaking-exported-api = true +allow-unwrap-in-tests = true +cognitive-complexity-threshold = 25 +excessive-nesting-threshold = 5 diff --git a/crates/clash-verge-signal/Cargo.toml b/crates/clash-verge-signal/Cargo.toml index f8a03ac48..12c5b124f 100644 --- a/crates/clash-verge-signal/Cargo.toml +++ b/crates/clash-verge-signal/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2024" rust-version = "1.91" -[dependencies] +[target.'cfg(target_os = "linux")'.dependencies] clash-verge-logging = { workspace = true } log = { workspace = true } tokio = { workspace = true, features = ["signal"] } diff --git a/src-tauri/build.rs b/src-tauri/build.rs index 13df77750..1f67c509e 100644 --- a/src-tauri/build.rs +++ b/src-tauri/build.rs @@ -1,3 +1,5 @@ +#![deny(clippy::expect_used, clippy::unwrap_used)] + fn main() -> Result<(), Box> { if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") && std::env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc") diff --git a/src-tauri/examples/frontend-contract.rs b/src-tauri/examples/frontend-contract.rs index 933b424fe..045f596d3 100644 --- a/src-tauri/examples/frontend-contract.rs +++ b/src-tauri/examples/frontend-contract.rs @@ -1,3 +1,5 @@ +#![deny(clippy::expect_used, clippy::unwrap_used)] + // Dev-only target: Tauri ships everything under src/bin/ to /usr/bin in deb/rpm // bundles (PR #8131), so this generator must stay an example, never a bin. fn main() -> Result<(), Box> { diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 61382454d..7a6905602 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1,4 +1,5 @@ #![allow(non_snake_case)] +#![deny(clippy::expect_used, clippy::unwrap_used)] #![recursion_limit = "512"] mod cmd; diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 20f54300e..25ead2a49 100755 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] +#![deny(clippy::expect_used, clippy::unwrap_used)] use std::process::ExitCode; #[cfg(not(all(feature = "perf-harness", target_os = "macos")))]