summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorChuck <chuck@intelligence.org>2019-09-16 08:44:33 -0700
committerLinus Heckemann <git@sphalerite.org>2019-11-04 15:11:45 +0100
commit88183eb484e14eb12aecd2788f6178fe95ec6256 (patch)
treeb87bdcd5a40976b251e5e42a266a664553c0abcd /nixos
parentaa8e1d5f1e44d5b24538f4b105b9323bd586be61 (diff)
downloadnixpkgs-88183eb484e14eb12aecd2788f6178fe95ec6256.tar
nixpkgs-88183eb484e14eb12aecd2788f6178fe95ec6256.tar.gz
nixpkgs-88183eb484e14eb12aecd2788f6178fe95ec6256.tar.bz2
nixpkgs-88183eb484e14eb12aecd2788f6178fe95ec6256.tar.lz
nixpkgs-88183eb484e14eb12aecd2788f6178fe95ec6256.tar.xz
nixpkgs-88183eb484e14eb12aecd2788f6178fe95ec6256.tar.zst
nixpkgs-88183eb484e14eb12aecd2788f6178fe95ec6256.zip
Per reviewer request, cast the other side.
I don't think this matters.  As long as one or the other of these is
a std::string, I get an operator== that looks at content rather than
pointer equality.  I picked casting the constant over casting the dynamic
thing in hopes that the compiler would have a better chance at optimizing
away any runtime cost.

Deferring to reviewer.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/installer/tools/nixos-option/nixos-option.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/nixos/modules/installer/tools/nixos-option/nixos-option.cc b/nixos/modules/installer/tools/nixos-option/nixos-option.cc
index fc9315423dd..536d67c2d09 100644
--- a/nixos/modules/installer/tools/nixos-option/nixos-option.cc
+++ b/nixos/modules/installer/tools/nixos-option/nixos-option.cc
@@ -140,7 +140,7 @@ bool isOption(Context * ctx, const Value & v)
         if (evaluated_type.type != tString) {
             return false;
         }
-        return evaluated_type.string.s == static_cast<std::string>("option");
+        return static_cast<std::string>(evaluated_type.string.s) == "option";
     } catch (Error &) {
         return false;
     }