From 18e82c4591f993ac1e43a27bf5434aef0973702d Mon Sep 17 00:00:00 2001 From: Michael Daniels Date: Thu, 30 Apr 2026 18:43:34 -0400 Subject: [PATCH] lib: remove unused let bindings and args@{} uses --- lib/fileset/default.nix | 2 -- lib/filesystem.nix | 1 - lib/meta.nix | 1 - lib/network/internal.nix | 1 - lib/options.nix | 2 +- lib/tests/misc.nix | 3 +-- lib/tests/modules/deferred-module-error.nix | 6 ------ lib/tests/modules/deferred-module.nix | 3 +-- lib/tests/modules/disable-module-bad-key.nix | 11 ----------- lib/tests/modules/types-attrTag.nix | 1 - 10 files changed, 3 insertions(+), 28 deletions(-) diff --git a/lib/fileset/default.nix b/lib/fileset/default.nix index 60b5913a6e86..6d3593f8f247 100644 --- a/lib/fileset/default.nix +++ b/lib/fileset/default.nix @@ -123,7 +123,6 @@ let pathExists seq typeOf - nixVersion ; inherit (lib.lists) @@ -138,7 +137,6 @@ let inherit (lib.strings) isStringLike - versionOlder ; inherit (lib.filesystem) diff --git a/lib/filesystem.nix b/lib/filesystem.nix index 5e31e8e2311c..9f05c05eb7cd 100644 --- a/lib/filesystem.nix +++ b/lib/filesystem.nix @@ -371,7 +371,6 @@ in let inherit (lib) concatMapAttrs - id makeScope recurseIntoAttrs removeSuffix diff --git a/lib/meta.nix b/lib/meta.nix index 3341caf0e0fb..3079f79f2f50 100644 --- a/lib/meta.nix +++ b/lib/meta.nix @@ -19,7 +19,6 @@ let isString match typeOf - elemAt ; in diff --git a/lib/network/internal.nix b/lib/network/internal.nix index 2e439c15f16c..adda711444fd 100644 --- a/lib/network/internal.nix +++ b/lib/network/internal.nix @@ -23,7 +23,6 @@ let */ ipv6Bits = 128; ipv6Pieces = 8; # 'x:x:x:x:x:x:x:x' - ipv6PieceBits = 16; # One piece in range from 0 to 0xffff. ipv6PieceMaxValue = 65535; # 2^16 - 1 in let diff --git a/lib/options.nix b/lib/options.nix index 6191a876cdd4..accbb56ff34a 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -468,7 +468,7 @@ rec { : 3\. Function argument */ mergeUniqueOption = - args@{ + { message, # WARNING: the default merge function assumes that the definition is a valid (option) value. You MUST pass a merge function if the return value needs to be # - type checked beyond what .check does (which should be very little; only on the value head; not attribute values, etc) diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index f257d9953fc3..e2872dcafce9 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -51,7 +51,6 @@ let filter filterAttrs fix - fold foldAttrs foldl foldl' @@ -4794,7 +4793,7 @@ runTests { # for sub-directories testPackagesFromDirectoryNestedScopes = let - inherit (lib) makeScope recurseIntoAttrs; + inherit (lib) makeScope; emptyScope = makeScope lib.callPackageWith (_: { }); in { diff --git a/lib/tests/modules/deferred-module-error.nix b/lib/tests/modules/deferred-module-error.nix index aec15dc53495..2f74421b2da5 100644 --- a/lib/tests/modules/deferred-module-error.nix +++ b/lib/tests/modules/deferred-module-error.nix @@ -3,16 +3,10 @@ let inherit (lib) types mkOption - setDefaultModuleLocation evalModules ; inherit (types) deferredModule - lazyAttrsOf - submodule - str - raw - enum ; in { diff --git a/lib/tests/modules/deferred-module.nix b/lib/tests/modules/deferred-module.nix index 0b280b824674..e14afb54f213 100644 --- a/lib/tests/modules/deferred-module.nix +++ b/lib/tests/modules/deferred-module.nix @@ -1,12 +1,11 @@ { lib, ... }: let - inherit (lib) types mkOption setDefaultModuleLocation; + inherit (lib) types mkOption; inherit (types) deferredModule lazyAttrsOf submodule str - raw enum ; in diff --git a/lib/tests/modules/disable-module-bad-key.nix b/lib/tests/modules/disable-module-bad-key.nix index a29a00e2e093..825f3b3139bf 100644 --- a/lib/tests/modules/disable-module-bad-key.nix +++ b/lib/tests/modules/disable-module-bad-key.nix @@ -1,15 +1,4 @@ { lib, ... }: -let - inherit (lib) mkOption types; - - moduleWithKey = - { config, ... }: - { - config = { - enable = true; - }; - }; -in { imports = [ ./declare-enable.nix diff --git a/lib/tests/modules/types-attrTag.nix b/lib/tests/modules/types-attrTag.nix index f30c1fc904f8..d48badae391f 100644 --- a/lib/tests/modules/types-attrTag.nix +++ b/lib/tests/modules/types-attrTag.nix @@ -6,7 +6,6 @@ }: let inherit (lib) mkOption types; - forceDeep = x: builtins.deepSeq x x; mergedSubOption = (options.merged.type.getSubOptions options.merged.loc).extensible; in {