treewide: use lib.warnIf where appropriate
This commit is contained in:
+3
-3
@@ -37,7 +37,7 @@ let
|
||||
setAttrByPath
|
||||
toList
|
||||
types
|
||||
warn
|
||||
warnIf
|
||||
;
|
||||
inherit (lib.options)
|
||||
isOption
|
||||
@@ -516,8 +516,8 @@ rec {
|
||||
value = if opt ? apply then opt.apply res.mergedValue else res.mergedValue;
|
||||
|
||||
warnDeprecation =
|
||||
if opt.type.deprecationMessage == null then id
|
||||
else warn "The type `types.${opt.type.name}' of option `${showOption loc}' defined in ${showFiles opt.declarations} is deprecated. ${opt.type.deprecationMessage}";
|
||||
warnIf (opt.type.deprecationMessage != null)
|
||||
"The type `types.${opt.type.name}' of option `${showOption loc}' defined in ${showFiles opt.declarations} is deprecated. ${opt.type.deprecationMessage}";
|
||||
|
||||
in warnDeprecation opt //
|
||||
{ value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
|
||||
|
||||
+2
-2
@@ -644,8 +644,8 @@ rec {
|
||||
floatToString = float: let
|
||||
result = toString float;
|
||||
precise = float == fromJSON result;
|
||||
in if precise then result
|
||||
else lib.warn "Imprecise conversion from float to string ${result}" result;
|
||||
in lib.warnIf (!precise) "Imprecise conversion from float to string ${result}"
|
||||
result;
|
||||
|
||||
/* Check whether a value can be coerced to a string */
|
||||
isCoercibleToString = x:
|
||||
|
||||
Reference in New Issue
Block a user