diff --git a/examples/build-bot.rs b/examples/build-bot.rs index 16a5b7d..f7f7041 100644 --- a/examples/build-bot.rs +++ b/examples/build-bot.rs @@ -27,23 +27,20 @@ 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, _) => { - client.send_privmsg( - "#commits", - format!( - "[{}/{}] ({}) {} [{}]", - repository_slug, - branch, - &commit[..7], - commit_message, - features, - ), - )?; + if let Command::Response(Response::RPL_ISUPPORT, _) = message.command { + client.send_privmsg( + "#commits", + format!( + "[{}/{}] ({}) {} [{}]", + repository_slug, + branch, + &commit[..7], + commit_message, + features, + ), + )?; - client.send_quit("QUIT")?; - } - _ => (), + client.send_quit("QUIT")?; } } diff --git a/examples/multiserver.rs b/examples/multiserver.rs index b241b7c..5ab2c4c 100644 --- a/examples/multiserver.rs +++ b/examples/multiserver.rs @@ -45,13 +45,10 @@ 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 msg.contains("pickles") { - sender.send_privmsg(target, "Hi!")?; - } + if let Command::PRIVMSG(ref target, ref msg) = message.command { + if msg.contains("pickles") { + sender.send_privmsg(target, "Hi!")?; } - _ => (), } Ok(()) diff --git a/examples/repeater.rs b/examples/repeater.rs index 1ce41a5..5738abc 100644 --- a/examples/repeater.rs +++ b/examples/repeater.rs @@ -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; diff --git a/examples/simple.rs b/examples/simple.rs index 9f8413b..986ae2d 100644 --- a/examples/simple.rs +++ b/examples/simple.rs @@ -19,13 +19,10 @@ 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 msg.contains(client.current_nickname()) { - sender.send_privmsg(target, "Hi!")?; - } + if let Command::PRIVMSG(ref target, ref msg) = message.command { + if msg.contains(client.current_nickname()) { + sender.send_privmsg(target, "Hi!")?; } - _ => (), } } diff --git a/examples/simple_plaintext.rs b/examples/simple_plaintext.rs index c3f65e2..08ef0e7 100644 --- a/examples/simple_plaintext.rs +++ b/examples/simple_plaintext.rs @@ -20,13 +20,10 @@ 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 msg.contains(client.current_nickname()) { - sender.send_privmsg(target, "Hi!")?; - } + if let Command::PRIVMSG(ref target, ref msg) = message.command { + if msg.contains(client.current_nickname()) { + sender.send_privmsg(target, "Hi!")?; } - _ => (), } } diff --git a/examples/simple_proxy.rs b/examples/simple_proxy.rs index 8e9783f..db10af0 100644 --- a/examples/simple_proxy.rs +++ b/examples/simple_proxy.rs @@ -22,13 +22,10 @@ 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 msg.contains(client.current_nickname()) { - sender.send_privmsg(target, "Hi!")?; - } + if let Command::PRIVMSG(ref target, ref msg) = message.command { + if msg.contains(client.current_nickname()) { + sender.send_privmsg(target, "Hi!")?; } - _ => (), } }