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 <mhartmay@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Acked-by: Finn Callies <fcallies@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
Marc Hartmayer
2024-11-11 12:15:19 +00:00
committed by Steffen Eiden
parent e6c17461a3
commit 2155b83c1f

View File

@@ -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"