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.
This commit is contained in:
Thomas Frans
2024-01-07 00:13:03 +01:00
committed by Henrik Friedrichsen
parent dee424d141
commit 2a4178e069
4 changed files with 12 additions and 4 deletions

View File

@@ -19,6 +19,13 @@ members = [
"xtask" "xtask"
] ]
[workspace.lints.clippy]
use_self = "deny"
multiple_inherent_impl = "deny"
[lints]
workspace = true
[profile.release] [profile.release]
lto = true lto = true
codegen-units = 1 codegen-units = 1

View File

@@ -1,5 +1,3 @@
#![deny(clippy::use_self, clippy::multiple_inherent_impl)]
#[macro_use] #[macro_use]
extern crate cursive; extern crate cursive;
#[macro_use] #[macro_use]

View File

@@ -13,3 +13,6 @@ clap = "4.4.13"
[dependencies.ncspot] [dependencies.ncspot]
default-features = false default-features = false
path = ".." path = ".."
[lints]
workspace = true

View File

@@ -20,8 +20,8 @@ impl TryFrom<&ArgMatches> for XTaskSubcommand {
fn try_from(value: &ArgMatches) -> Result<Self, Self::Error> { fn try_from(value: &ArgMatches) -> Result<Self, Self::Error> {
if let Some(subcommand) = value.subcommand() { if let Some(subcommand) = value.subcommand() {
match subcommand.0 { match subcommand.0 {
"generate-manpage" => Ok(XTaskSubcommand::GenerateManpage), "generate-manpage" => Ok(Self::GenerateManpage),
"generate-shell-completion" => Ok(XTaskSubcommand::GenerateShellCompletion), "generate-shell-completion" => Ok(Self::GenerateShellCompletion),
_ => Err(Error::new(clap::error::ErrorKind::InvalidSubcommand)), _ => Err(Error::new(clap::error::ErrorKind::InvalidSubcommand)),
} }
} else { } else {