summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlara Modin <klarasmodin@gmail.com>2022-06-21 23:19:18 +0200
committerKlara Modin <klarasmodin@gmail.com>2022-06-21 23:19:18 +0200
commit4cd11888673363de3f53ddc84cfb49c1eea3cebf (patch)
tree0e905626c5f80fb014d6ae6c6f9c384f2beaa19a
parent98c262b6515c16be0aec54c6c16f70d0c052a822 (diff)
clear up iterator useHEADmaster
-rw-r--r--src/ui.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/ui.rs b/src/ui.rs
index 7aa693a..bcc258c 100644
--- a/src/ui.rs
+++ b/src/ui.rs
@@ -190,8 +190,7 @@ impl UI {
match message.command.as_str() {
"PRIVMSG" => {
let prefix = message.prefix.clone().unwrap_or(String::new());
- let mut iter = prefix.split("!");
- let nick = iter.next().unwrap_or("");
+ let nick = prefix.split("!").next().unwrap_or(&"");
if let (Some(target), Some(content)) = (message.params.get(0), message.params.get(1)) {
self.put_str(&format!("{}:<{}> {}\n", target, nick, content));
}
@@ -218,9 +217,8 @@ impl UI {
}
fn print_params_2(&mut self, params: &[String]) {
- let mut iter = params.iter().skip(1);
- while let Some(output_x) = iter.next() {
- self.put_str(&format!("{} ", output_x));
+ for param in params.iter().skip(1) {
+ self.put_str(&format!("{} ", param));
}
self.put_str("\n");
}