on master help sign in
Save space by having the command hashmap use const static refs.
commit87e7a0de3fae7ccdd7e2b69908a8875eeb49f24c authorBlaž Hrastnik <blaz@mxxn.io> dateFri 7 May 2021, 17:13 (5 years ago) parentdbeae43
1 file changed+3−3
helix-term/src/commands.rs+3−3
helix-term/src/commands.rs+3−3
@@ -905,13 +905,13 @@ mod cmd {
905905 },
906906 ];
907907
908− pub static COMMANDS: Lazy<HashMap<&'static str, Command>> = Lazy::new(|| {
908+ pub static COMMANDS: Lazy<HashMap<&'static str, &'static Command>> = Lazy::new(|| {
909909 let mut map = HashMap::new();
910910
911911 for cmd in COMMAND_LIST {
912− map.insert(cmd.name, cmd.clone());
912+ map.insert(cmd.name, cmd);
913913 if let Some(alias) = cmd.alias {
914− map.insert(alias, cmd.clone());
914+ map.insert(alias, cmd);
915915 }
916916 }
917917