notedeck

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

commit e7c3755a08fea9a936efbebb995ab97c19bad92a
parent 953496fc74f035ed2f4b31670b09e62f4a5f950f
Author: kernelkind <kernelkind@gmail.com>
Date:   Tue, 29 Apr 2025 13:22:53 -0400

pass `NoteAction` by value instead of reference

Signed-off-by: kernelkind <kernelkind@gmail.com>

Diffstat:
Mcrates/notedeck_chrome/src/chrome.rs | 2+-
Mcrates/notedeck_columns/src/actionbar.rs | 15+++++++--------
Mcrates/notedeck_columns/src/nav.rs | 9++-------
3 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/crates/notedeck_chrome/src/chrome.rs b/crates/notedeck_chrome/src/chrome.rs @@ -501,7 +501,7 @@ fn chrome_handle_app_action( let txn = Transaction::new(ctx.ndb).unwrap(); notedeck_columns::actionbar::execute_and_process_note_action( - &note_action, + note_action, ctx.ndb, columns .decks_cache diff --git a/crates/notedeck_columns/src/actionbar.rs b/crates/notedeck_columns/src/actionbar.rs @@ -24,7 +24,7 @@ pub enum TimelineOpenResult { /// The note action executor for notedeck_columns #[allow(clippy::too_many_arguments)] fn execute_note_action( - action: &NoteAction, + action: NoteAction, ndb: &Ndb, router: &mut Router<Route>, timeline_cache: &mut TimelineCache, @@ -38,19 +38,18 @@ fn execute_note_action( ) -> Option<TimelineOpenResult> { match action { NoteAction::Reply(note_id) => { - router.route_to(Route::reply(*note_id)); + router.route_to(Route::reply(note_id)); None } NoteAction::Profile(pubkey) => { - let kind = TimelineKind::Profile(*pubkey); + let kind = TimelineKind::Profile(pubkey); router.route_to(Route::Timeline(kind.clone())); timeline_cache.open(ndb, note_cache, txn, pool, &kind) } NoteAction::Note(note_id) => 'ex: { - let Ok(thread_selection) = - ThreadSelection::from_note_id(ndb, note_cache, txn, *note_id) + let Ok(thread_selection) = ThreadSelection::from_note_id(ndb, note_cache, txn, note_id) else { tracing::error!("No thread selection for {}?", hex::encode(note_id.bytes())); break 'ex None; @@ -70,7 +69,7 @@ fn execute_note_action( } NoteAction::Quote(note_id) => { - router.route_to(Route::quote(*note_id)); + router.route_to(Route::quote(note_id)); None } @@ -81,7 +80,7 @@ fn execute_note_action( let sender = cur_acc.key.pubkey; - match zap_action { + match &zap_action { ZapAction::Send(target) => 'a: { let Some(wallet) = get_wallet_for_mut(accounts, global_wallet, sender.bytes()) else { @@ -122,7 +121,7 @@ fn execute_note_action( /// Execute a NoteAction and process the result #[allow(clippy::too_many_arguments)] pub fn execute_and_process_note_action( - action: &NoteAction, + action: NoteAction, ndb: &Ndb, columns: &mut Columns, col: usize, diff --git a/crates/notedeck_columns/src/nav.rs b/crates/notedeck_columns/src/nav.rs @@ -134,7 +134,7 @@ impl RenderNavResponse { #[must_use = "Make sure to save columns if result is true"] pub fn process_render_nav_response( - &self, + self, app: &mut Damus, ctx: &mut AppContext<'_>, ui: &mut egui::Ui, @@ -142,12 +142,7 @@ impl RenderNavResponse { let mut switching_occured: bool = false; let col = self.column; - if let Some(action) = self - .response - .response - .as_ref() - .or(self.response.title_response.as_ref()) - { + if let Some(action) = self.response.response.or(self.response.title_response) { // start returning when we're finished posting match action { RenderNavAction::Back => {