Skip to content

Commit

Permalink
Move lints into Cargo.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
uklotzde committed Nov 16, 2023
1 parent 91b9193 commit 0f7fb24
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 29 deletions.
28 changes: 28 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,34 @@ ni-traktor-kontrol-s4mk3 = ["hid"]
# Experimental features
experimental-param = ["dep:crossbeam-utils", "dep:enum-as-inner"]

[lints.rust]
future_incompatible = "warn"
let_underscore = "warn"
missing_debug_implementations = "warn"
rust_2018_idioms = "warn"
rust_2021_compatibility = "warn"
unreachable_pub = "warn"
unsafe_code = "warn"
unused = "warn"

[lints.clippy]
pedantic = "warn"
clone_on_ref_ptr = "warn"
missing_const_for_fn = "warn"
self_named_module_files = "warn"

# Repetitions of module/type names occur frequently when using many
# modules for keeping the size of the source files handy. Often
# types have the same name as their parent module.
module_name_repetitions = "allow"

# Repeating the type name in `Default::default()` expressions
# is not needed as long as the context is obvious.
default_trait_access = "allow"

# The error types returned should be self-explanatory.
missing_errors_doc = "allow"

[[example]]
name = "midi-dj-controller-hotplug"
path = "examples/midi_dj_controller_hotplug.rs"
Expand Down
5 changes: 3 additions & 2 deletions examples/midi_dj_controller_hotplug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn main() {
pretty_env_logger::init();

match run() {
Ok(_) => (),
Ok(()) => (),
Err(err) => log::error!("{err}"),
}
}
Expand Down Expand Up @@ -186,7 +186,7 @@ where

#[derive(Debug, Clone)]
struct LoggingInputPortEventSink {
pub port_index: PortIndex,
port_index: PortIndex,
}

impl ControlInputEventSink for LoggingInputPortEventSink {
Expand All @@ -199,6 +199,7 @@ impl ControlInputEventSink for LoggingInputPortEventSink {
}
}

#[allow(clippy::needless_pass_by_value)]
fn reconnect_midi_controller<I>(
device: &mut MidirDevice<I::MidiInputGateway>,
new_input_gateway: Option<&I>,
Expand Down
4 changes: 2 additions & 2 deletions examples/ni_traktor_kontrol_s4mk3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn main() {
pretty_env_logger::init();

match run() {
Ok(_) => (),
Ok(()) => (),
Err(err) => log::error!("{err}"),
}
}
Expand Down Expand Up @@ -87,7 +87,7 @@ fn run() -> anyhow::Result<()> {
device_info = new_device_context.info()
);
new_device_context.initialize();
device_context = Some(new_device_context)
device_context = Some(new_device_context);
}

log::info!("TODO: Run event loop");
Expand Down
25 changes: 0 additions & 25 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,6 @@

#![allow(rustdoc::invalid_rust_codeblocks)]
#![doc = include_str!("../README.md")]
// Opt-in for allowed-by-default lints (in alphabetical order)
// See also: <https://doc.rust-lang.org/rustc/lints>
#![warn(future_incompatible)]
#![warn(let_underscore)]
#![warn(missing_debug_implementations)]
//#![warn(missing_docs)] // TODO
#![warn(rust_2018_idioms)]
#![warn(rust_2021_compatibility)]
#![warn(unreachable_pub)]
#![warn(unsafe_code)]
#![warn(unused)]
// Clippy lints
#![warn(clippy::pedantic)]
// Additional restrictions
#![warn(clippy::clone_on_ref_ptr)]
#![warn(clippy::missing_const_for_fn)]
#![warn(clippy::self_named_module_files)]
// Repetitions of module/type names occur frequently when using many
// modules for keeping the size of the source files handy. Often
// types have the same name as their parent module.
#![allow(clippy::module_name_repetitions)]
// Repeating the type name in `..Default::default()` expressions
// is not needed since the context is obvious.
#![allow(clippy::default_trait_access)]
#![allow(clippy::missing_errors_doc)] // FIXME

use std::{
borrow::Cow,
Expand Down

0 comments on commit 0f7fb24

Please sign in to comment.