From f750de076e945ac36daff03bd5c663bb9f36c1b0 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Fri, 16 Oct 2020 10:45:21 +0300 Subject: [PATCH] chore: deny all clippy lints --- src/channel.rs | 1 + src/commands/query.rs | 4 ++-- src/commands/start.rs | 2 +- src/commands/suggest.rs | 4 ++-- src/lib.rs | 2 ++ 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/channel.rs b/src/channel.rs index 689d928..f784a68 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -57,6 +57,7 @@ macro_rules! init_commands { )); } )? + #[allow(clippy::needless_update)] let command = $cmd_name { $($arg_name $(: $arg_value)?,)* ..Default::default() }; self.run_command(command) } diff --git a/src/commands/query.rs b/src/commands/query.rs index 9b33ecc..f720db6 100644 --- a/src/commands/query.rs +++ b/src/commands/query.rs @@ -46,14 +46,14 @@ impl StreamCommand for QueryCommand<'_> { match RE.captures(&message) { None => Err(Error::new(ErrorKind::WrongSonicResponse)), Some(caps) => { - if &caps["pending_query_id"] != &caps["event_query_id"] { + if caps["pending_query_id"] != caps["event_query_id"] { Err(Error::new(ErrorKind::QueryResponseError( "Pending id and event id don't match", ))) } else if caps["objects"].is_empty() { Ok(vec![]) } else { - Ok(caps["objects"].split(" ").map(str::to_owned).collect()) + Ok(caps["objects"].split_whitespace().map(str::to_owned).collect()) } } } diff --git a/src/commands/start.rs b/src/commands/start.rs index a8337b8..e4d069f 100644 --- a/src/commands/start.rs +++ b/src/commands/start.rs @@ -44,7 +44,7 @@ impl StreamCommand for StartCommand { None => Err(Error::new(ErrorKind::SwitchMode)), Some(caps) => { if self.mode.to_str() != &caps["mode"] { - return Err(Error::new(ErrorKind::SwitchMode)); + Err(Error::new(ErrorKind::SwitchMode)) } else { let protocol_version: usize = caps["protocol"].parse().expect("Must be digit by regex"); diff --git a/src/commands/suggest.rs b/src/commands/suggest.rs index 8f0619b..0b92e1f 100644 --- a/src/commands/suggest.rs +++ b/src/commands/suggest.rs @@ -42,14 +42,14 @@ impl StreamCommand for SuggestCommand<'_> { match RE.captures(&message) { None => Err(Error::new(ErrorKind::WrongSonicResponse)), Some(caps) => { - if &caps["pending_suggest_id"] != &caps["event_suggest_id"] { + if caps["pending_suggest_id"] != caps["event_suggest_id"] { Err(Error::new(ErrorKind::QueryResponseError( "Pending id and event id don't match", ))) } else if caps["words"].is_empty() { Ok(vec![]) } else { - Ok(caps["words"].split(" ").map(str::to_owned).collect()) + Ok(caps["words"].split_whitespace().map(str::to_owned).collect()) } } } diff --git a/src/lib.rs b/src/lib.rs index b0e6382..ae929a1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -80,6 +80,8 @@ unused_qualifications )] #![warn(missing_docs)] +// Clippy lints +#![deny(clippy::all)] #[cfg(not(any(feature = "ingest", feature = "search", feature = "control")))] compile_error!(r#"Either features "ingest" or "search" or "control" must be enabled for "sonic-channel" crate"#);