mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 19:55:41 +03:00
lib: move assertMsg and assertOneOf to their own library file
Since the `assertOneOf` uses `lib.generators`, they are not really trivial anymore and should go into their own library file.
This commit is contained in:
parent
3e45b61a99
commit
efdf618330
5 changed files with 53 additions and 46 deletions
|
@ -509,7 +509,7 @@ rec {
|
|||
=> 3
|
||||
*/
|
||||
last = list:
|
||||
assert assertMsg (list != []) "lists.last: list must not be empty!";
|
||||
assert lib.assertMsg (list != []) "lists.last: list must not be empty!";
|
||||
elemAt list (length list - 1);
|
||||
|
||||
/* Return all elements but the last
|
||||
|
@ -519,7 +519,7 @@ rec {
|
|||
=> [ 1 2 ]
|
||||
*/
|
||||
init = list:
|
||||
assert assertMsg (list != []) "lists.init: list must not be empty!";
|
||||
assert lib.assertMsg (list != []) "lists.init: list must not be empty!";
|
||||
take (length list - 1) list;
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue