From d51f4852e1368490966e0886522268bd2bd22fb2 Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Thu, 16 Nov 2023 09:30:59 +1300 Subject: [PATCH] cargo fmt --- gossip-bin/src/ui/feed/note/mod.rs | 45 ++++++++++++++---------------- gossip-lib/src/storage/mod.rs | 19 +++++++------ 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/gossip-bin/src/ui/feed/note/mod.rs b/gossip-bin/src/ui/feed/note/mod.rs index 4c81ab9b6..c2d348e0f 100644 --- a/gossip-bin/src/ui/feed/note/mod.rs +++ b/gossip-bin/src/ui/feed/note/mod.rs @@ -722,31 +722,28 @@ fn render_note_inner( { app.draft_data.draft.push(' '); } - let nostr_url: NostrUrl = if note - .event - .kind - .is_replaceable() - { - let param = match note.event.parameter() { - Some(p) => p, - None => "".to_owned(), - }; - let event_addr = EventAddr { - d: param, - relays: relays.clone(), - kind: note.event.kind, - author: note.event.pubkey, - }; - event_addr.into() - } else { - let event_pointer = EventPointer { - id: note.event.id, - relays: relays.clone(), - author: None, - kind: None, + let nostr_url: NostrUrl = + if note.event.kind.is_replaceable() { + let param = match note.event.parameter() { + Some(p) => p, + None => "".to_owned(), + }; + let event_addr = EventAddr { + d: param, + relays: relays.clone(), + kind: note.event.kind, + author: note.event.pubkey, + }; + event_addr.into() + } else { + let event_pointer = EventPointer { + id: note.event.id, + relays: relays.clone(), + author: None, + kind: None, + }; + event_pointer.into() }; - event_pointer.into() - }; app.draft_data .draft .push_str(&format!("{}", nostr_url)); diff --git a/gossip-lib/src/storage/mod.rs b/gossip-lib/src/storage/mod.rs index 2cdd801f4..555ce084a 100644 --- a/gossip-lib/src/storage/mod.rs +++ b/gossip-lib/src/storage/mod.rs @@ -487,9 +487,9 @@ impl Storage { let txn = self.env.read_txn()?; Ok(self - .general - .get(&txn, b"migration_level")? - .map(|bytes| u32::from_be_bytes(bytes[..4].try_into().unwrap()))) + .general + .get(&txn, b"migration_level")? + .map(|bytes| u32::from_be_bytes(bytes[..4].try_into().unwrap()))) } /// Write the user's encrypted private key @@ -1218,12 +1218,15 @@ impl Storage { &[event.kind], &[event.pubkey], None, - |e| if event.kind.is_parameterized_replaceable() { - e.parameter() == event.parameter() - } else { - true + |e| { + if event.kind.is_parameterized_replaceable() { + e.parameter() == event.parameter() + } else { + true + } }, - false)?; + false, + )?; let mut found_newer = false; for old in existing {