aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2018-03-16 03:29:59 +0100
committerJokler <jokler.contact@gmail.com>2018-03-16 03:29:59 +0100
commite510da21a359ffa96843da53c464bce3ad1f7810 (patch)
treeb6415e9a84481c825b8fc492b56a3256fa9df41b /src
parent54fc50c782b79c2de32dc2ce50a79ae1b471db63 (diff)
downloadfrippy-e510da21a359ffa96843da53c464bce3ad1f7810.tar.gz
frippy-e510da21a359ffa96843da53c464bce3ad1f7810.zip
Fix continue in tell by removing the inner loop
Diffstat (limited to 'src')
-rw-r--r--src/plugins/tell/mod.rs23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/plugins/tell/mod.rs b/src/plugins/tell/mod.rs
index f3ca90c..e8a2bb6 100644
--- a/src/plugins/tell/mod.rs
+++ b/src/plugins/tell/mod.rs
@@ -65,16 +65,19 @@ impl<T: Database> Tell<T> {
.list_channels()
.expect("The irc crate should not be compiled with the \"nochanlists\" feature");
- for channel in channels {
- if let Some(users) = client.list_users(&channel) {
- if users
- .iter()
- .any(|u| u.get_nickname().eq_ignore_ascii_case(&receiver))
- {
- online.push(receiver);
- continue;
- }
- }
+ if let Some(_) = channels
+ .iter()
+ .map(|c| client.list_users(&c))
+ .map(|opt| {
+ opt.and_then(|us| {
+ us.into_iter()
+ .find(|u| u.get_nickname().eq_ignore_ascii_case(&receiver))
+ })
+ })
+ .find(|opt| opt.is_some())
+ {
+ online.push(receiver);
+ continue;
}
let tm = time::now().to_timespec();