lib/generators: short-circuit important-field check with any
toHyprconf' tested every important prefix with a non-strict foldl that always scanned the full list. lib.any expresses the same any-prefix-matches intent and stops at the first match. Runs once per attribute in the Hyprland generator.
This commit is contained in:
@@ -10,11 +10,11 @@
|
||||
let
|
||||
inherit (lib)
|
||||
all
|
||||
any
|
||||
concatMapStringsSep
|
||||
concatStrings
|
||||
concatStringsSep
|
||||
filterAttrs
|
||||
foldl
|
||||
generators
|
||||
hasPrefix
|
||||
isAttrs
|
||||
@@ -29,8 +29,7 @@
|
||||
toHyprconf' =
|
||||
indent: attrs:
|
||||
let
|
||||
isImportantField =
|
||||
n: _: foldl (acc: prev: if hasPrefix prev n then true else acc) false importantPrefixes;
|
||||
isImportantField = n: _: any (prev: hasPrefix prev n) importantPrefixes;
|
||||
importantFields = filterAttrs isImportantField attrs;
|
||||
withoutImportantFields = fields: removeAttrs fields (attrNames importantFields);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user