From 0c04ac7ea08a6ed6046efb50e20e74aced4fcbb3 Mon Sep 17 00:00:00 2001 From: Myk Melez Date: Wed, 19 Dec 2018 14:32:49 -0800 Subject: [PATCH 1/3] require Rust 1.30 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d7bf1e7..2cb0c5b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ os: - osx rust: -- 1.20.0 +- 1.30.0 - stable - nightly From 6a3bee7cea15379bcadf2570190775fdbd038737 Mon Sep 17 00:00:00 2001 From: Myk Melez Date: Wed, 19 Dec 2018 15:46:48 -0800 Subject: [PATCH 2/3] explicitly destructure Ok result --- src/transaction.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/transaction.rs b/src/transaction.rs index ff95b27..77165e7 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -448,7 +448,7 @@ mod test { { let mut cur = txn.open_ro_cursor(db).unwrap(); let iter = cur.iter_dup_of(b"key1"); - let vals = iter.map(|(_,x)| x).collect::>(); + let vals = iter.filter_map(Result::ok).map(|(_,x)| x).collect::>(); assert_eq!(vals, vec![b"val1", b"val2", b"val3"]); } @@ -463,7 +463,7 @@ mod test { { let mut cur = txn.open_ro_cursor(db).unwrap(); let iter = cur.iter_dup_of(b"key1"); - let vals = iter.map(|(_,x)| x).collect::>(); + let vals = iter.filter_map(Result::ok).map(|(_,x)| x).collect::>(); assert_eq!(vals, vec![b"val1", b"val3"]); let iter = cur.iter_dup_of(b"key2"); From 846268ef92b9c05baa5338ed535ed6c15799e130 Mon Sep 17 00:00:00 2001 From: Myk Melez Date: Wed, 19 Dec 2018 16:17:56 -0800 Subject: [PATCH 3/3] panic instead of ignoring error --- src/transaction.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/transaction.rs b/src/transaction.rs index 77165e7..16804d3 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -448,7 +448,7 @@ mod test { { let mut cur = txn.open_ro_cursor(db).unwrap(); let iter = cur.iter_dup_of(b"key1"); - let vals = iter.filter_map(Result::ok).map(|(_,x)| x).collect::>(); + let vals = iter.map(|x| x.unwrap()).map(|(_,x)| x).collect::>(); assert_eq!(vals, vec![b"val1", b"val2", b"val3"]); } @@ -463,7 +463,7 @@ mod test { { let mut cur = txn.open_ro_cursor(db).unwrap(); let iter = cur.iter_dup_of(b"key1"); - let vals = iter.filter_map(Result::ok).map(|(_,x)| x).collect::>(); + let vals = iter.map(|x| x.unwrap()).map(|(_,x)| x).collect::>(); assert_eq!(vals, vec![b"val1", b"val3"]); let iter = cur.iter_dup_of(b"key2");