From e510da21a359ffa96843da53c464bce3ad1f7810 Mon Sep 17 00:00:00 2001 From: Jokler Date: Fri, 16 Mar 2018 03:29:59 +0100 Subject: Fix continue in tell by removing the inner loop --- src/plugins/tell/mod.rs | 23 +++++++++++++---------- 1 file 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 Tell { .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(); -- cgit v1.2.3-70-g09d2