refactor: add Default derives to CmdRegistry and Keymap
Add #[derive(Default)] to CmdRegistry and Keymap structs, enabling easy construction of empty instances with CmdRegistry::default() and Keymap::default(). This simplifies initialization code and follows Rust conventions for types that hold empty collections as their default state. Co-Authored-By: fiddlerwoaroof/git-smart-commit (unsloth/Qwen3.5-35B-A3B-GGUF:Q5_K_M)
This commit is contained in:
@ -69,6 +69,7 @@ struct CmdEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Registry of commands constructible from text or from interactive context.
|
/// Registry of commands constructible from text or from interactive context.
|
||||||
|
#[derive(Default)]
|
||||||
pub struct CmdRegistry {
|
pub struct CmdRegistry {
|
||||||
entries: Vec<CmdEntry>,
|
entries: Vec<CmdEntry>,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,6 +75,7 @@ pub enum Binding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A keymap maps key patterns to bindings (command names or prefix sub-keymaps).
|
/// A keymap maps key patterns to bindings (command names or prefix sub-keymaps).
|
||||||
|
#[derive(Default)]
|
||||||
pub struct Keymap {
|
pub struct Keymap {
|
||||||
bindings: HashMap<KeyPattern, Binding>,
|
bindings: HashMap<KeyPattern, Binding>,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user