diff options
| author | nickelc <constantin.nickel@gmail.com> | 2023-02-28 12:49:28 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-28 06:49:28 -0500 |
| commit | f4be222c4485a0f4a87b119c1054c528a99208e6 (patch) | |
| tree | ed5691efdeea16184c53576b8a555351594bd34c /src/colors.rs | |
| parent | 17ad30e514b8f98982c36389c099a0417b0e8063 (diff) | |
Reduce allocations during `--show-colors` (#1315)
The colors are already sorted and can be returned as they are defined.
Diffstat (limited to 'src/colors.rs')
| -rw-r--r-- | src/colors.rs | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/colors.rs b/src/colors.rs index 00e826a..5c9d5c9 100644 --- a/src/colors.rs +++ b/src/colors.rs @@ -1,7 +1,5 @@ -use std::collections::HashMap; - -pub fn color_groups() -> HashMap<String, Vec<(String, String)>> { - [ +pub fn color_groups() -> Vec<(&'static str, Vec<(&'static str, &'static str)>)> { + vec![ ( "Blue", vec![ @@ -199,15 +197,4 @@ pub fn color_groups() -> HashMap<String, Vec<(String, String)>> { ], ), ] - .iter() - .map(|(name, colors)| { - ( - name.to_string(), - colors - .iter() - .map(|(color, hex)| (color.to_string(), hex.to_string())) - .collect(), - ) - }) - .collect() } |
