diff options
| author | eaon <eaon@mit.edu> | 2018-11-21 17:30:36 +0100 |
|---|---|---|
| committer | eaon <eaon@mit.edu> | 2018-11-21 17:32:57 +0100 |
| commit | bed2b54ea403872b7e540ade251e9609090a7cf5 (patch) | |
| tree | 23c29189c754d8a61154d231f076bbc6ce5c2153 /src/query.rs | |
| parent | 678010129d42a1647458a6919a0e17148e7bc506 (diff) | |
| download | mail-bed2b54ea403872b7e540ade251e9609090a7cf5.tar.gz | |
Use the ? operator instead of the try! macro
Diffstat (limited to 'src/query.rs')
| -rw-r--r-- | src/query.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/query.rs b/src/query.rs index c73d4ca..38711e9 100644 --- a/src/query.rs +++ b/src/query.rs @@ -82,7 +82,7 @@ impl<'d> Query<'d> { pub fn count_messages(self: &Self) -> Result<u32> { let mut cnt = 0; - try!(unsafe { ffi::notmuch_query_count_messages(self.handle.ptr, &mut cnt,) }.as_result()); + unsafe { ffi::notmuch_query_count_messages(self.handle.ptr, &mut cnt) }.as_result()?; Ok(cnt) } @@ -93,7 +93,7 @@ impl<'d> Query<'d> { pub fn count_threads(self: &Self) -> Result<u32> { let mut cnt = 0; - try!(unsafe { ffi::notmuch_query_count_threads(self.handle.ptr, &mut cnt,) }.as_result()); + unsafe { ffi::notmuch_query_count_threads(self.handle.ptr, &mut cnt) }.as_result()?; Ok(cnt) } @@ -107,10 +107,8 @@ pub trait QueryExt<'d> { let queryref = query.into(); let mut thrds = ptr::null_mut(); - try!( - unsafe { ffi::notmuch_query_search_threads(queryref.handle.ptr, &mut thrds) } - .as_result() - ); + unsafe { ffi::notmuch_query_search_threads(queryref.handle.ptr, &mut thrds) } + .as_result()?; Ok(Threads::from_ptr(thrds, Supercow::phantom(queryref))) } @@ -122,10 +120,8 @@ pub trait QueryExt<'d> { let queryref = query.into(); let mut msgs = ptr::null_mut(); - try!( - unsafe { ffi::notmuch_query_search_messages(queryref.handle.ptr, &mut msgs) } - .as_result() - ); + unsafe { ffi::notmuch_query_search_messages(queryref.handle.ptr, &mut msgs) } + .as_result()?; Ok(Messages::from_ptr(msgs, Supercow::phantom(queryref))) } |
