chore: deny all clippy lints

This commit is contained in:
Dmitriy Pleshevskiy 2020-10-16 10:45:21 +03:00
parent dce4806161
commit f750de076e
5 changed files with 8 additions and 5 deletions

View file

@ -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)
}

View file

@ -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())
}
}
}

View file

@ -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");

View file

@ -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())
}
}
}

View file

@ -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"#);