From b283fdfdd39ae151be0e79e79d62dd5f13e285e8 Mon Sep 17 00:00:00 2001 From: Linus Färnstrand Date: Sat, 30 Mar 2024 23:48:22 +0100 Subject: Enable more of the Allowed-by-default lints in rustc * macro_use_extern_crate - Forbid #[macro_use] to bring macros into global scope. Even using `extern crate` is deprecated by now, so just extra protection against that * explicit_outlives_requirements - Warn aginst explicit lifetime bounds that can be inferred from the code. Keeps noise away. * absolute_paths_not_starting_with_crate - Catches Rust 2015 style absolute paths and denies them. * missing_abi - Force explicitly stating the ABI of `extern` items. Less implicit code * unused_lifetimes - Warn if you have lifetimes that are not used. Same reason as warning against unused variables * unused_macro_rules - Warn if you have a declarative macro with a rule that is never used. Basically same reason as warning on unused variables. Removes dead code --- Cargo.toml | 11 ++++++++++- test/Cargo.toml | 10 +++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c79b3969ff..d517588917 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,8 +45,17 @@ members = [ # Security non_ascii_idents = "forbid" -# Modern, easy to read style and opinionated best practices +# Deny old style Rust rust_2018_idioms = "deny" +macro_use_extern_crate = "deny" +absolute_paths_not_starting_with_crate = "deny" + +# Easy to read style and opinionated best practices +explicit_outlives_requirements = "warn" +missing_abi = "deny" +unused_lifetimes = "warn" +unused_macro_rules = "warn" + [workspace.lints.clippy] unused_async = "deny" diff --git a/test/Cargo.toml b/test/Cargo.toml index 35c87980e9..d8763a3cc4 100644 --- a/test/Cargo.toml +++ b/test/Cargo.toml @@ -20,8 +20,16 @@ members = [ # Security non_ascii_idents = "forbid" -# Modern, easy to read style and opinionated best practices +# Deny old style Rust rust_2018_idioms = "deny" +macro_use_extern_crate = "deny" +absolute_paths_not_starting_with_crate = "deny" + +# Easy to read style and opinionated best practices +explicit_outlives_requirements = "warn" +missing_abi = "deny" +unused_lifetimes = "warn" +unused_macro_rules = "warn" [workspace.lints.clippy] unused_async = "deny" -- cgit v1.3-3-g829e