From 3c561adf054f89fa0acf3a21eb0aba3a20e0345a Mon Sep 17 00:00:00 2001 From: Edward Langley Date: Sat, 4 Apr 2026 10:01:27 -0700 Subject: [PATCH] chore: clippy send + sync warnings, drop warnings --- src/command/cmd.rs | 2 +- src/ui/app.rs | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/command/cmd.rs b/src/command/cmd.rs index 14882d4..dc07d19 100644 --- a/src/command/cmd.rs +++ b/src/command/cmd.rs @@ -38,7 +38,7 @@ pub struct CmdContext<'a> { } /// A command that reads state and produces effects. -pub trait Cmd: Debug { +pub trait Cmd: Debug + Send + Sync { fn execute(&self, ctx: &CmdContext) -> Vec>; fn name(&self) -> &str; } diff --git a/src/ui/app.rs b/src/ui/app.rs index 24b21a1..4fcaaeb 100644 --- a/src/ui/app.rs +++ b/src/ui/app.rs @@ -141,9 +141,11 @@ impl App { pub fn handle_key(&mut self, key: KeyEvent) -> Result<()> { // Transient keymap (prefix key sequence) takes priority if let Some(transient) = self.transient_keymap.take() { - let ctx = self.cmd_context(key.code, key.modifiers); - if let Some(effects) = transient.dispatch(&ctx, key.code, key.modifiers) { - drop(ctx); + let effects = { + let ctx = self.cmd_context(key.code, key.modifiers); + transient.dispatch(&ctx, key.code, key.modifiers) + }; + if let Some(effects) = effects { self.apply_effects(effects); } // Whether matched or not, transient is consumed @@ -151,13 +153,14 @@ impl App { } // Try mode keymap — if a binding matches, apply effects and return - let ctx = self.cmd_context(key.code, key.modifiers); - if let Some(effects) = self.keymap_set.dispatch(&ctx, key.code, key.modifiers) { - drop(ctx); + let effects = { + let ctx = self.cmd_context(key.code, key.modifiers); + self.keymap_set.dispatch(&ctx, key.code, key.modifiers) + }; + if let Some(effects) = effects { self.apply_effects(effects); return Ok(()); } - drop(ctx); // Fallback: old-style handlers for modes not yet migrated to keymaps match &self.mode.clone() {