From e744077fa6247ebcfc7e0ca9478f32eaa6c1691e Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Wed, 3 May 2017 21:39:23 -0400 Subject: [PATCH] Handle FETCH uids on multiple lines --- src/main.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6fae94d..ca27c6f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -191,16 +191,14 @@ fn main() { let mut num_unseen = 0; let mut uids = Vec::new(); - for line in &unseen { - for uid in line.split_whitespace() - .skip(2) - .take_while(|&e| e != "" && e != "Completed") { - if let Ok(uid) = usize::from_str_radix(uid, 10) { - if notified.insert(uid) { - uids.push(format!("{}", uid)); - } - num_unseen += 1; + let unseen = unseen.join(" "); + let unseen = unseen.split_whitespace().skip(2); + for uid in unseen.take_while(|&e| e != "" && e != "Completed") { + if let Ok(uid) = usize::from_str_radix(uid, 10) { + if notified.insert(uid) { + uids.push(format!("{}", uid)); } + num_unseen += 1; } }