From 776cc9822b8b46d5b42e798e29162f169096da95 Mon Sep 17 00:00:00 2001 From: Yuki Kishimoto Date: Mon, 13 Nov 2023 16:39:56 +0100 Subject: [PATCH] sqlite: fix clippy --- crates/nostr-sqlite/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/nostr-sqlite/src/lib.rs b/crates/nostr-sqlite/src/lib.rs index 7ba533c1a..643d9c22f 100644 --- a/crates/nostr-sqlite/src/lib.rs +++ b/crates/nostr-sqlite/src/lib.rs @@ -105,7 +105,9 @@ impl NostrDatabase for SQLiteDatabase { conn.interact(move |conn| { let mut stmt = conn.prepare_cached("SELECT COUNT(*) FROM events;")?; let mut rows = stmt.query([])?; - let row = rows.next()?.ok_or(Error::NotFound("count result".into()))?; + let row = rows + .next()? + .ok_or_else(|| Error::NotFound("count result".into()))?; let count: usize = row.get(0)?; Ok(count) }) @@ -229,7 +231,9 @@ impl NostrDatabase for SQLiteDatabase { conn.interact(move |conn| { let mut stmt = conn.prepare_cached("SELECT event FROM events WHERE event_id = ?;")?; let mut rows = stmt.query([event_id.to_hex()])?; - let row = rows.next()?.ok_or(Error::NotFound("event".into()))?; + let row = rows + .next()? + .ok_or_else(|| Error::NotFound("event".into()))?; let buf: Vec = row.get(0)?; Ok(Event::decode(&buf)?) })