notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit bb6c68e05cc332cadbe4b6bac35ec13171e034d4
parent 395ff57edf33c8e3a63b712b280ddbf557852332
Author: William Casarin <jb55@jb55.com>
Date:   Thu, 20 Jun 2024 13:05:57 -0700

clippy postbox cleanups

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Msrc/ui/note/post.rs | 5++---
Msrc/ui/profile/picture.rs | 10+++++-----
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/ui/note/post.rs b/src/ui/note/post.rs @@ -1,5 +1,4 @@ use crate::app::Damus; -use crate::draft::Draft; use crate::ui::{Preview, PreviewConfig, View}; use crate::{ui, Error}; use egui::widgets::text_edit::TextEdit; @@ -45,7 +44,7 @@ impl<'app, 'p> PostView<'app, 'p> { let poster_pfp = self .app .ndb - .get_profile_by_pubkey(&txn, poster_pubkey) + .get_profile_by_pubkey(txn, poster_pubkey) .as_ref() .ok() .and_then(|p| ui::ProfilePic::from_profile(&mut self.app.img_cache, p)); @@ -66,7 +65,7 @@ impl<'app, 'p> PostView<'app, 'p> { .app .drafts .entry(enostr::NoteId::new(*self.replying_to)) - .or_insert_with(|| Draft::new()); + .or_default(); ui.add(TextEdit::multiline(&mut draft.buffer).frame(false)); diff --git a/src/ui/profile/picture.rs b/src/ui/profile/picture.rs @@ -24,11 +24,11 @@ impl<'cache, 'url> ProfilePic<'cache, 'url> { cache: &'cache mut ImageCache, profile: &nostrdb::ProfileRecord<'url>, ) -> Option<Self> { - if let Some(url) = profile.record().profile().and_then(|p| p.picture()) { - Some(ProfilePic::new(cache, url)) - } else { - None - } + profile + .record() + .profile() + .and_then(|p| p.picture()) + .map(|url| ProfilePic::new(cache, url)) } pub fn default_size() -> f32 {