diff --git a/Cargo.toml b/Cargo.toml index ce1f47e..c502ea8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/examples/midi_dj_controller_hotplug.rs b/examples/midi_dj_controller_hotplug.rs index 2bbefa7..819cdf6 100644 --- a/examples/midi_dj_controller_hotplug.rs +++ b/examples/midi_dj_controller_hotplug.rs @@ -84,7 +84,7 @@ fn main() { pretty_env_logger::init(); match run() { - Ok(_) => (), + Ok(()) => (), Err(err) => log::error!("{err}"), } } @@ -186,7 +186,7 @@ where #[derive(Debug, Clone)] struct LoggingInputPortEventSink { - pub port_index: PortIndex, + port_index: PortIndex, } impl ControlInputEventSink for LoggingInputPortEventSink { @@ -199,6 +199,7 @@ impl ControlInputEventSink for LoggingInputPortEventSink { } } +#[allow(clippy::needless_pass_by_value)] fn reconnect_midi_controller( device: &mut MidirDevice, new_input_gateway: Option<&I>, diff --git a/examples/ni_traktor_kontrol_s4mk3.rs b/examples/ni_traktor_kontrol_s4mk3.rs index 021c592..7e5519f 100644 --- a/examples/ni_traktor_kontrol_s4mk3.rs +++ b/examples/ni_traktor_kontrol_s4mk3.rs @@ -9,7 +9,7 @@ fn main() { pretty_env_logger::init(); match run() { - Ok(_) => (), + Ok(()) => (), Err(err) => log::error!("{err}"), } } @@ -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"); diff --git a/src/lib.rs b/src/lib.rs index 5515545..a3ef4d9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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: -#![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,