statix: enable eta_reduction

Enable statix's eta_reduction rule and apply its auto-fixes across the affected modules.
This commit is contained in:
Austin Horstman
2026-04-08 15:52:58 -05:00
parent 74b0e97937
commit de90ee2408
13 changed files with 14 additions and 17 deletions

View File

@@ -107,7 +107,7 @@ rec {
sameOrNull = x: y: if x == y then y else null;
# A bit naive to just check the first entry…
sharedDefType = foldl' sameOrNull (head defTypes) defTypes;
allChecked = all (x: check x) vals;
allChecked = all check vals;
in
if sharedDefType == null then
throw (

View File

@@ -138,7 +138,7 @@ let
submoduleToAttrs = m: lib.filterAttrs (name: v: name != "_module" && v != null) m;
in
lib.generators.toINI { mkSectionName = mk2ndLevelSectionName; } (
lib.mapAttrs (name: x: submoduleToAttrs x) cfg.tags
lib.mapAttrs (name: submoduleToAttrs) cfg.tags
)
)
+ ''

View File

@@ -193,7 +193,7 @@ in
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
home.sessionVariables = lib.mapAttrs (n: v: toString v) (
home.sessionVariables = lib.mapAttrs (n: toString) (
lib.filterAttrs (n: v: v != [ ] && v != null) {
FZF_ALT_C_COMMAND = cfg.changeDirWidgetCommand;
FZF_ALT_C_OPTS = cfg.changeDirWidgetOptions;

View File

@@ -144,7 +144,7 @@ in
if lib.isBool v then
"${optionalString (!v) "no"}${k}"
else if lib.isList v then
''${k} "${concatStringsSep ":" (map (w: toString w) v)}"''
''${k} "${concatStringsSep ":" (map toString v)}"''
else
"${k} ${if lib.isInt v then toString v else ''"${v}"''}"
}";

View File

@@ -31,7 +31,7 @@ let
path = int;
bool = "0"; # "on/off" opts are disabled with `=0`
string = option;
list = lib.concatStringsSep "," (lib.lists.forEach option (x: toString x));
list = lib.concatStringsSep "," (lib.lists.forEach option toString);
}
.${builtins.typeOf option};

View File

@@ -210,9 +210,7 @@ let
genGroupsChannels = group: concatStringsSep "\n" (genChannelStrings group.name group.channels);
# Generate all channel configurations for all groups for this account.
in
concatStringsSep "\n" (
lib.remove "" (mapAttrsToList (name: group: genGroupsChannels group) groups)
);
concatStringsSep "\n" (lib.remove "" (mapAttrsToList (name: genGroupsChannels) groups));
# Given the attr set of groups, return a string which maps channels to groups
genAccountGroups =

View File

@@ -98,7 +98,7 @@ in
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
home.sessionVariables = lib.mapAttrs (n: v: toString v) (
home.sessionVariables = lib.mapAttrs (n: toString) (
lib.filterAttrs (n: v: v != [ ] && v != null) {
SKIM_ALT_C_COMMAND = cfg.changeDirWidgetCommand;
SKIM_ALT_C_OPTS = cfg.changeDirWidgetOptions;

View File

@@ -294,7 +294,7 @@ let
version="9"
logging="no"
''
+ lib.concatStrings (map (f: mkFilterToIniString f) filters);
+ lib.concatStrings (map mkFilterToIniString filters);
getAccountsForProfile =
profileName: accounts:

View File

@@ -75,9 +75,9 @@ let
getAttrs [ "collections" "conflictResolution" "metadata" "partialSync" ] a.vdirsyncer
);
pairs = mapAttrs (_: v: pair v) vdirsyncerAccounts;
localStorages = mapAttrs (_: v: localStorage v) vdirsyncerAccounts;
remoteStorages = mapAttrs (_: v: remoteStorage v) vdirsyncerAccounts;
pairs = mapAttrs (_: pair) vdirsyncerAccounts;
localStorages = mapAttrs (_: localStorage) vdirsyncerAccounts;
remoteStorages = mapAttrs (_: remoteStorage) vdirsyncerAccounts;
optionString =
n: v:

View File

@@ -41,7 +41,7 @@ let
description = "pair of ${x.description}";
};
mkDefaultAttrs = mapAttrs (n: v: mkDefault v);
mkDefaultAttrs = mapAttrs (n: mkDefault);
# Basically a tinkered lib.generators.mkKeyValueDefault
# It either serializes a top-level definition "key: { values };"

View File

@@ -188,7 +188,7 @@ in
in
if allQuadletsSameType then
''
${concatStringsSep "\n" (map (quadlet: formatServiceName quadlet) quadlets)}
${concatStringsSep "\n" (map formatServiceName quadlets)}
''
else
abort ''

View File

@@ -65,7 +65,7 @@ let
# top-level attributes with non-attrsets so we're forcing the attrsets to
# come last.
_config = lib.mapAttrsToList convert (lib.filterAttrs (k: v: !isAttrs v) attr);
_config' = lib.mapAttrsToList convert (lib.filterAttrs (k: v: isAttrs v) attr);
_config' = lib.mapAttrsToList convert (lib.filterAttrs (k: isAttrs) attr);
config = _config ++ _config';
in
lib.concatStringsSep "\n" config;

View File

@@ -5,7 +5,6 @@ disabled = [
"deprecated_to_path",
"empty_inherit",
"empty_let_in",
"eta_reduction",
"faster_groupby",
"faster_zipattrswith",
"legacy_let_syntax",