examples: Fix all clippy warnings

This commit is contained in:
Hyeon Kim 2021-11-15 05:03:16 +09:00
parent 82387576a0
commit 66f18c2044
No known key found for this signature in database
GPG key ID: 0F85F46EE242057F
6 changed files with 26 additions and 41 deletions

View file

@ -27,8 +27,7 @@ async fn main() -> irc::error::Result<()> {
let mut stream = client.stream()?;
while let Some(message) = stream.next().await.transpose()? {
match message.command {
Command::Response(Response::RPL_ISUPPORT, _) => {
if let Command::Response(Response::RPL_ISUPPORT, _) = message.command {
client.send_privmsg(
"#commits",
format!(
@ -43,8 +42,6 @@ async fn main() -> irc::error::Result<()> {
client.send_quit("QUIT")?;
}
_ => (),
}
}
Ok(())

View file

@ -45,14 +45,11 @@ async fn main() -> irc::error::Result<()> {
fn process_msg(sender: &Sender, message: Message) -> error::Result<()> {
print!("{}", message);
match message.command {
Command::PRIVMSG(ref target, ref msg) => {
if let Command::PRIVMSG(ref target, ref msg) = message.command {
if msg.contains("pickles") {
sender.send_privmsg(target, "Hi!")?;
}
}
_ => (),
}
Ok(())
}

View file

@ -22,7 +22,7 @@ async fn main() -> irc::error::Result<()> {
let message = stream.select_next_some().await?;
if let Command::PRIVMSG(ref target, ref msg) = message.command {
if msg.starts_with(&*client.current_nickname()) {
if msg.starts_with(client.current_nickname()) {
let tokens: Vec<_> = msg.split(' ').collect();
if tokens.len() > 2 {
let n = tokens[0].len() + tokens[1].len() + 2;

View file

@ -19,14 +19,11 @@ async fn main() -> irc::error::Result<()> {
while let Some(message) = stream.next().await.transpose()? {
print!("{}", message);
match message.command {
Command::PRIVMSG(ref target, ref msg) => {
if let Command::PRIVMSG(ref target, ref msg) = message.command {
if msg.contains(client.current_nickname()) {
sender.send_privmsg(target, "Hi!")?;
}
}
_ => (),
}
}
Ok(())

View file

@ -20,14 +20,11 @@ async fn main() -> irc::error::Result<()> {
while let Some(message) = stream.next().await.transpose()? {
print!("{}", message);
match message.command {
Command::PRIVMSG(ref target, ref msg) => {
if let Command::PRIVMSG(ref target, ref msg) = message.command {
if msg.contains(client.current_nickname()) {
sender.send_privmsg(target, "Hi!")?;
}
}
_ => (),
}
}
Ok(())

View file

@ -22,14 +22,11 @@ async fn main() -> irc::error::Result<()> {
while let Some(message) = stream.next().await.transpose()? {
print!("{}", message);
match message.command {
Command::PRIVMSG(ref target, ref msg) => {
if let Command::PRIVMSG(ref target, ref msg) = message.command {
if msg.contains(client.current_nickname()) {
sender.send_privmsg(target, "Hi!")?;
}
}
_ => (),
}
}
Ok(())