Skip to content

Commit

Permalink
style: share linting options across packages
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ThomasFrans committed Jan 6, 2024
1 parent cef08e6 commit 58e46b7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![deny(clippy::use_self, clippy::multiple_inherent_impl)]

#[macro_use]
extern crate cursive;
#[macro_use]
Expand Down
3 changes: 3 additions & 0 deletions xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ clap = "4.4.12"
[dependencies.ncspot]
default-features = false
path = ".."

[lints]
workspace = true
4 changes: 2 additions & 2 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ impl TryFrom<&ArgMatches> for XTaskSubcommand {
fn try_from(value: &ArgMatches) -> Result<Self, Self::Error> {
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 {
Expand Down

0 comments on commit 58e46b7

Please sign in to comment.