diff options
| author | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2018-11-01 21:55:00 +0100 |
|---|---|---|
| committer | Dirk Van Haerenborgh <vhdirk@gmail.com> | 2018-11-01 21:55:00 +0100 |
| commit | 7d2be237297c16628cb3d58774e808cac9c92fc1 (patch) | |
| tree | 55cb240828bac9968f94166e740b567b66928e3b /tests | |
| parent | 2932d67d87fa2ff41fcdf46ce269ba5b49294930 (diff) | |
| download | mail-7d2be237297c16628cb3d58774e808cac9c92fc1.tar.gz | |
improve lifetime management with supercow
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/main.rs | 12 |
1 files changed, 5 insertions, 7 deletions
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); |
