chore: clippy send + sync warnings, drop warnings
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user