on master help sign in
Save space by having the command hashmap use const static refs.
87e7a0dBlaž Hrastnik
helix-term/src/commands.rs+3−3
@@ -905,13 +905,13 @@ mod cmd {
905 },
905 },
906 ];
906 ];
907
907
908− pub static COMMANDS: Lazy<HashMap<&'static str, Command>> = Lazy::new(|| {
908+ pub static COMMANDS: Lazy<HashMap<&'static str, &'static Command>> = Lazy::new(|| {
909 let mut map = HashMap::new();
909 let mut map = HashMap::new();
910
910
911 for cmd in COMMAND_LIST {
911 for cmd in COMMAND_LIST {
912− map.insert(cmd.name, cmd.clone());
912+ map.insert(cmd.name, cmd);
913 if let Some(alias) = cmd.alias {
913 if let Some(alias) = cmd.alias {
914− map.insert(alias, cmd.clone());
914+ map.insert(alias, cmd);
915 }
915 }
916 }
916 }
917
917