From 7d2be237297c16628cb3d58774e808cac9c92fc1 Mon Sep 17 00:00:00 2001 From: Dirk Van Haerenborgh Date: Thu, 1 Nov 2018 21:55:00 +0100 Subject: improve lifetime management with supercow --- tests/main.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/main.rs b/tests/main.rs index 6840dc0..d790e21 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -1,6 +1,8 @@ extern crate notmuch; extern crate dirs; +use notmuch::StreamingIterator; + fn main() { let mut mail_path = dirs::home_dir().unwrap(); @@ -18,15 +20,11 @@ fn main() { let query = db.create_query(&"".to_string()).unwrap(); let mut threads = query.search_threads().unwrap(); - loop { - match threads.next() { - Some(thread) => { - println!("thread {:?} {:?}", thread.subject(), thread.authors()); - }, - None => { break } - } + while let Some(thread) = threads.next() { + println!("thread {:?} {:?}", thread.subject(), thread.authors()); } + }, Err(err) =>{ println!("Got error while trying to open db: {:?}", err); -- cgit v1.2.1