From bae59474eef3fd28758a2a4e5e4fb8d50c93a3c4 Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Sun, 14 Feb 2021 18:00:41 +0000 Subject: a few more tiny touch ups (#7) * a few more tiny touch ups * all praise clippy --- src/local/database.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/local/database.rs') diff --git a/src/local/database.rs b/src/local/database.rs index e2df9ba5..8e4b00ef 100644 --- a/src/local/database.rs +++ b/src/local/database.rs @@ -1,7 +1,7 @@ use chrono::Utc; use std::path::Path; -use eyre::{eyre, Result}; +use eyre::Result; use rusqlite::{params, Connection}; use rusqlite::{Transaction, NO_PARAMS}; @@ -125,16 +125,11 @@ impl Database for Sqlite { where id = ?1", )?; - let mut iter = stmt.query_map(params![id], |row| { + let history = stmt.query_row(params![id], |row| { history_from_sqlite_row(Some(id.to_string()), row) })?; - let history = iter.next().unwrap(); - - match history { - Ok(i) => Ok(i), - Err(e) => Err(eyre!("could not find item: {}", e)), - } + Ok(history) } fn update(&self, h: &History) -> Result<()> { -- cgit v1.3.1