chore: clippy send + sync warnings, drop warnings

This commit is contained in:
Edward Langley
2026-04-04 10:01:27 -07:00
parent 0db89b1e3a
commit 3c561adf05
2 changed files with 11 additions and 8 deletions

View File

@ -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<Box<dyn Effect>>;
fn name(&self) -> &str;
}

View File

@ -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() {