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.
|
/// 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 execute(&self, ctx: &CmdContext) -> Vec<Box<dyn Effect>>;
|
||||||
fn name(&self) -> &str;
|
fn name(&self) -> &str;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -141,9 +141,11 @@ impl App {
|
|||||||
pub fn handle_key(&mut self, key: KeyEvent) -> Result<()> {
|
pub fn handle_key(&mut self, key: KeyEvent) -> Result<()> {
|
||||||
// Transient keymap (prefix key sequence) takes priority
|
// Transient keymap (prefix key sequence) takes priority
|
||||||
if let Some(transient) = self.transient_keymap.take() {
|
if let Some(transient) = self.transient_keymap.take() {
|
||||||
|
let effects = {
|
||||||
let ctx = self.cmd_context(key.code, key.modifiers);
|
let ctx = self.cmd_context(key.code, key.modifiers);
|
||||||
if let Some(effects) = transient.dispatch(&ctx, key.code, key.modifiers) {
|
transient.dispatch(&ctx, key.code, key.modifiers)
|
||||||
drop(ctx);
|
};
|
||||||
|
if let Some(effects) = effects {
|
||||||
self.apply_effects(effects);
|
self.apply_effects(effects);
|
||||||
}
|
}
|
||||||
// Whether matched or not, transient is consumed
|
// Whether matched or not, transient is consumed
|
||||||
@ -151,13 +153,14 @@ impl App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try mode keymap — if a binding matches, apply effects and return
|
// Try mode keymap — if a binding matches, apply effects and return
|
||||||
|
let effects = {
|
||||||
let ctx = self.cmd_context(key.code, key.modifiers);
|
let ctx = self.cmd_context(key.code, key.modifiers);
|
||||||
if let Some(effects) = self.keymap_set.dispatch(&ctx, key.code, key.modifiers) {
|
self.keymap_set.dispatch(&ctx, key.code, key.modifiers)
|
||||||
drop(ctx);
|
};
|
||||||
|
if let Some(effects) = effects {
|
||||||
self.apply_effects(effects);
|
self.apply_effects(effects);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
drop(ctx);
|
|
||||||
|
|
||||||
// Fallback: old-style handlers for modes not yet migrated to keymaps
|
// Fallback: old-style handlers for modes not yet migrated to keymaps
|
||||||
match &self.mode.clone() {
|
match &self.mode.clone() {
|
||||||
|
|||||||
Reference in New Issue
Block a user