From af923dc62dc95eb833a552e391f52bf37a30dc60 Mon Sep 17 00:00:00 2001 From: Myk Melez Date: Fri, 30 Nov 2018 17:11:51 -0800 Subject: [PATCH] explicitly identify reference in match patterns --- src/cursor.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cursor.rs b/src/cursor.rs index 0cdf5411..568261b4 100644 --- a/src/cursor.rs +++ b/src/cursor.rs @@ -262,12 +262,12 @@ impl <'txn> Iterator for Iter<'txn> { fn next(&mut self) -> Option> { match self { - Iter::Ok { cursor, ref mut op, next_op, _marker } => { + &mut Iter::Ok { cursor, ref mut op, next_op, _marker } => { let mut key = ffi::MDB_val { mv_size: 0, mv_data: ptr::null_mut() }; let mut data = ffi::MDB_val { mv_size: 0, mv_data: ptr::null_mut() }; - let op = mem::replace(op, *next_op); + let op = mem::replace(op, next_op); unsafe { - match ffi::mdb_cursor_get(*cursor, &mut key, &mut data, op) { + match ffi::mdb_cursor_get(cursor, &mut key, &mut data, op) { ffi::MDB_SUCCESS => Some(Ok((val_to_slice(key), val_to_slice(data)))), // EINVAL can occur when the cursor was previously seeked to a non-existent value, // e.g. iter_from with a key greater than all values in the database. @@ -276,7 +276,7 @@ impl <'txn> Iterator for Iter<'txn> { } } }, - Iter::Err(err) => Some(Err(*err)), + &mut Iter::Err(err) => Some(Err(err)), } } } @@ -329,21 +329,21 @@ impl <'txn> Iterator for IterDup<'txn> { fn next(&mut self) -> Option> { match self { - IterDup::Ok { cursor, ref mut op, _marker } => { + &mut IterDup::Ok { cursor, ref mut op, _marker } => { let mut key = ffi::MDB_val { mv_size: 0, mv_data: ptr::null_mut() }; let mut data = ffi::MDB_val { mv_size: 0, mv_data: ptr::null_mut() }; let op = mem::replace(op, ffi::MDB_NEXT_NODUP); let err_code = unsafe { - ffi::mdb_cursor_get(*cursor, &mut key, &mut data, op) + ffi::mdb_cursor_get(cursor, &mut key, &mut data, op) }; if err_code == ffi::MDB_SUCCESS { - Some(Iter::new(*cursor, ffi::MDB_GET_CURRENT, ffi::MDB_NEXT_DUP)) + Some(Iter::new(cursor, ffi::MDB_GET_CURRENT, ffi::MDB_NEXT_DUP)) } else { None } }, - IterDup::Err(err) => Some(Iter::Err(*err)), + &mut IterDup::Err(err) => Some(Iter::Err(err)), } } }