summary refs log tree commit diff
path: root/lib/strings.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/strings.nix')
-rw-r--r--lib/strings.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/strings.nix b/lib/strings.nix
index 5010d9159cb..0f23b6b9d41 100644
--- a/lib/strings.nix
+++ b/lib/strings.nix
@@ -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: