examples: Fix all clippy warnings
This commit is contained in:
parent
82387576a0
commit
66f18c2044
6 changed files with 26 additions and 41 deletions
|
@ -27,23 +27,20 @@ async fn main() -> irc::error::Result<()> {
|
||||||
let mut stream = client.stream()?;
|
let mut stream = client.stream()?;
|
||||||
|
|
||||||
while let Some(message) = stream.next().await.transpose()? {
|
while let Some(message) = stream.next().await.transpose()? {
|
||||||
match message.command {
|
if let Command::Response(Response::RPL_ISUPPORT, _) = message.command {
|
||||||
Command::Response(Response::RPL_ISUPPORT, _) => {
|
client.send_privmsg(
|
||||||
client.send_privmsg(
|
"#commits",
|
||||||
"#commits",
|
format!(
|
||||||
format!(
|
"[{}/{}] ({}) {} [{}]",
|
||||||
"[{}/{}] ({}) {} [{}]",
|
repository_slug,
|
||||||
repository_slug,
|
branch,
|
||||||
branch,
|
&commit[..7],
|
||||||
&commit[..7],
|
commit_message,
|
||||||
commit_message,
|
features,
|
||||||
features,
|
),
|
||||||
),
|
)?;
|
||||||
)?;
|
|
||||||
|
|
||||||
client.send_quit("QUIT")?;
|
client.send_quit("QUIT")?;
|
||||||
}
|
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,13 +45,10 @@ async fn main() -> irc::error::Result<()> {
|
||||||
fn process_msg(sender: &Sender, message: Message) -> error::Result<()> {
|
fn process_msg(sender: &Sender, message: Message) -> error::Result<()> {
|
||||||
print!("{}", message);
|
print!("{}", message);
|
||||||
|
|
||||||
match message.command {
|
if let Command::PRIVMSG(ref target, ref msg) = message.command {
|
||||||
Command::PRIVMSG(ref target, ref msg) => {
|
if msg.contains("pickles") {
|
||||||
if msg.contains("pickles") {
|
sender.send_privmsg(target, "Hi!")?;
|
||||||
sender.send_privmsg(target, "Hi!")?;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
@ -22,7 +22,7 @@ async fn main() -> irc::error::Result<()> {
|
||||||
let message = stream.select_next_some().await?;
|
let message = stream.select_next_some().await?;
|
||||||
|
|
||||||
if let Command::PRIVMSG(ref target, ref msg) = message.command {
|
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();
|
let tokens: Vec<_> = msg.split(' ').collect();
|
||||||
if tokens.len() > 2 {
|
if tokens.len() > 2 {
|
||||||
let n = tokens[0].len() + tokens[1].len() + 2;
|
let n = tokens[0].len() + tokens[1].len() + 2;
|
||||||
|
|
|
@ -19,13 +19,10 @@ async fn main() -> irc::error::Result<()> {
|
||||||
while let Some(message) = stream.next().await.transpose()? {
|
while let Some(message) = stream.next().await.transpose()? {
|
||||||
print!("{}", message);
|
print!("{}", message);
|
||||||
|
|
||||||
match message.command {
|
if let Command::PRIVMSG(ref target, ref msg) = message.command {
|
||||||
Command::PRIVMSG(ref target, ref msg) => {
|
if msg.contains(client.current_nickname()) {
|
||||||
if msg.contains(client.current_nickname()) {
|
sender.send_privmsg(target, "Hi!")?;
|
||||||
sender.send_privmsg(target, "Hi!")?;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,10 @@ async fn main() -> irc::error::Result<()> {
|
||||||
while let Some(message) = stream.next().await.transpose()? {
|
while let Some(message) = stream.next().await.transpose()? {
|
||||||
print!("{}", message);
|
print!("{}", message);
|
||||||
|
|
||||||
match message.command {
|
if let Command::PRIVMSG(ref target, ref msg) = message.command {
|
||||||
Command::PRIVMSG(ref target, ref msg) => {
|
if msg.contains(client.current_nickname()) {
|
||||||
if msg.contains(client.current_nickname()) {
|
sender.send_privmsg(target, "Hi!")?;
|
||||||
sender.send_privmsg(target, "Hi!")?;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,13 +22,10 @@ async fn main() -> irc::error::Result<()> {
|
||||||
while let Some(message) = stream.next().await.transpose()? {
|
while let Some(message) = stream.next().await.transpose()? {
|
||||||
print!("{}", message);
|
print!("{}", message);
|
||||||
|
|
||||||
match message.command {
|
if let Command::PRIVMSG(ref target, ref msg) = message.command {
|
||||||
Command::PRIVMSG(ref target, ref msg) => {
|
if msg.contains(client.current_nickname()) {
|
||||||
if msg.contains(client.current_nickname()) {
|
sender.send_privmsg(target, "Hi!")?;
|
||||||
sender.send_privmsg(target, "Hi!")?;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue