From ae9f969e59fe0ca6017360636e47e169a375f5cc Mon Sep 17 00:00:00 2001 From: Conrad Dean Date: Mon, 22 Jul 2019 22:30:08 -0400 Subject: [PATCH] re structure result type nesting combined with correct .into call this was a bit of a trip! we will see if I actually did this correctly later... --- tolstoy/src/metadata.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tolstoy/src/metadata.rs b/tolstoy/src/metadata.rs index 4fec947e..fd699480 100644 --- a/tolstoy/src/metadata.rs +++ b/tolstoy/src/metadata.rs @@ -64,13 +64,15 @@ impl SyncMetadata { } pub fn remote_head(tx: &rusqlite::Transaction) -> Result { - tx.query_row( - "SELECT value FROM tolstoy_metadata WHERE key = ?", - &[&schema::REMOTE_HEAD_KEY], |r| { - let bytes: Vec = r.get(0).unwrap(); - Uuid::from_bytes(bytes.as_slice()) - } - )?.map_err(|e| e.into()) + Uuid::from_bytes( + tx.query_row( + "SELECT value FROM tolstoy_metadata WHERE key = ?", + rusqlite::params![&schema::REMOTE_HEAD_KEY], |r| { + let bytes: Vec = r.get(0).unwrap(); + Ok(bytes) + } + )?.as_slice() + ).map_err(|e| e.into()) } pub fn set_remote_head(tx: &rusqlite::Transaction, uuid: &Uuid) -> Result<()> {