From 872c4c6c5d8aecb36080dfd7984041e306b42cdc Mon Sep 17 00:00:00 2001 From: Edward Langley Date: Sun, 5 Apr 2026 01:07:08 -0700 Subject: [PATCH] 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) --- src/command/cmd.rs | 1 + src/command/keymap.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/command/cmd.rs b/src/command/cmd.rs index 3c9a25c..337ecda 100644 --- a/src/command/cmd.rs +++ b/src/command/cmd.rs @@ -69,6 +69,7 @@ struct CmdEntry { } /// Registry of commands constructible from text or from interactive context. +#[derive(Default)] pub struct CmdRegistry { entries: Vec, } diff --git a/src/command/keymap.rs b/src/command/keymap.rs index 2c0424c..325429c 100644 --- a/src/command/keymap.rs +++ b/src/command/keymap.rs @@ -75,6 +75,7 @@ pub enum Binding { } /// A keymap maps key patterns to bindings (command names or prefix sub-keymaps). +#[derive(Default)] pub struct Keymap { bindings: HashMap, }