From 2155b83c1fc49e1f22bded7a946c6c0eb7672403 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Mon, 11 Nov 2024 12:15:19 +0000 Subject: [PATCH] rust: Add more useful linting rules See https://doc.rust-lang.org/rustc/lints/groups.html https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html#non-ascii-idents For `missing_docs` there must a priority specified to fix the following error: warning: lint group `unused` has the same priority (0) as a lint --> Cargo.toml:25:1 | 19 | missing_docs = "deny" | ------------ has the same priority as this lint ... 25 | unused = "warn" | ^^^^^^ ------ has an implicit priority of 0 | = note: the order of the lints in the table is ignored by Cargo = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#lint_groups_priority = note: `#[warn(clippy::lint_groups_priority)]` on by default help: to have lints override the group set `unused` to a lower priority | 25 | unused = { level = "warn", priority = -1 } | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Marc Hartmayer Reviewed-by: Steffen Eiden Acked-by: Finn Callies Signed-off-by: Steffen Eiden --- rust/Cargo.toml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 5fc718f7..dff6c4ee 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -16,10 +16,13 @@ license = "MIT" rust-version = "1.75.0" [workspace.lints.rust] -missing_docs = "deny" +missing_docs = { level = "deny", priority = 1 } missing_debug_implementations = "warn" +non_ascii_idents = "warn" +nonstandard-style = "warn" trivial_numeric_casts = "warn" unstable_features = "warn" +unused = "warn" unused_import_braces = "warn" unused_qualifications = "warn"