From d6ab2fdf72e2b505539942f9527227d94a558101 Mon Sep 17 00:00:00 2001 From: Emile Clark-Boman Date: Wed, 28 Jan 2026 13:03:09 +1000 Subject: [PATCH] remove enfIsAttrsUnsafe --- nt/primitives/nt/trapdoor.nix | 5 ++--- nt/primitives/std/prim/attrs.nix | 8 ++------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/nt/primitives/nt/trapdoor.nix b/nt/primitives/nt/trapdoor.nix index 0b3f40b..0ff6579 100644 --- a/nt/primitives/nt/trapdoor.nix +++ b/nt/primitives/nt/trapdoor.nix @@ -8,7 +8,6 @@ inherit (this.std) enfHasAttr - enfHasAttrUnsafe ; inherit @@ -23,7 +22,7 @@ in rec { mkTrapdoorFn = decl: assert enfHasAttr "default" decl "mkTrapdoorFn"; - assert enfHasAttrUnsafe "unlock" decl "mkTrapdoorFn"; + assert enfHasAttr "unlock" decl "mkTrapdoorFn"; # return trapdoor function (x: if x == masterkey @@ -32,7 +31,7 @@ in rec { mkTrapdoorSet = decl: assert enfHasAttr "default" decl "mkTrapdoorSet"; - assert enfHasAttrUnsafe "unlock" decl "mkTrapdoorSet"; + assert enfHasAttr "unlock" decl "mkTrapdoorSet"; # return trapdoor set decl.default // { diff --git a/nt/primitives/std/prim/attrs.nix b/nt/primitives/std/prim/attrs.nix index e2bd7ec..fed98a5 100644 --- a/nt/primitives/std/prim/attrs.nix +++ b/nt/primitives/std/prim/attrs.nix @@ -27,13 +27,9 @@ in rec { in got == "set" || throw "${msg}: expected primitive nix type \"set\" but got \"${got}\""; - # NOTE: doesn't check if xs is type set, use enfHasAttr instead - enfHasAttrUnsafe = name: xs: msg: - hasAttr name xs || throw "${msg}: missing required attribute \"${name}\""; - - # NOTE: use enfHasAttr' if you can guarantee xs is type set enfHasAttr = name: xs: msg: - enfIsAttrs xs msg && enfHasAttrUnsafe name xs msg; + assert enfIsAttrs xs msg; + hasAttr name xs || throw "${msg}: missing required attribute \"${name}\""; getAttrOr = name: f: xs: if xs ? ${name}