From 58e46b71dc121924ea316cf17f390cd7631aa95a Mon Sep 17 00:00:00 2001 From: Thomas Frans Date: Sun, 7 Jan 2024 00:13:03 +0100 Subject: [PATCH] style: share linting options across packages Move the Rust and Clippy linting options into the Cargo manifest and share them with all the packages in the workspace. This ensures a consistent style in all packages. --- Cargo.toml | 7 +++++++ src/main.rs | 2 -- xtask/Cargo.toml | 3 +++ xtask/src/main.rs | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cf8669a36..bfa68c787 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,13 @@ members = [ "xtask" ] +[workspace.lints.clippy] +use_self = "deny" +multiple_inherent_impl = "deny" + +[lints] +workspace = true + [profile.release] lto = true codegen-units = 1 diff --git a/src/main.rs b/src/main.rs index a7bb5e1ca..b045e0d90 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,3 @@ -#![deny(clippy::use_self, clippy::multiple_inherent_impl)] - #[macro_use] extern crate cursive; #[macro_use] diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 5bfbfb787..490d3e24a 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -13,3 +13,6 @@ clap = "4.4.12" [dependencies.ncspot] default-features = false path = ".." + +[lints] +workspace = true diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 4a5f54111..f7a844632 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -20,8 +20,8 @@ impl TryFrom<&ArgMatches> for XTaskSubcommand { fn try_from(value: &ArgMatches) -> Result { if let Some(subcommand) = value.subcommand() { match subcommand.0 { - "generate-manpage" => Ok(XTaskSubcommand::GenerateManpage), - "generate-shell-completion" => Ok(XTaskSubcommand::GenerateShellCompletion), + "generate-manpage" => Ok(Self::GenerateManpage), + "generate-shell-completion" => Ok(Self::GenerateShellCompletion), _ => Err(Error::new(clap::error::ErrorKind::InvalidSubcommand)), } } else {