about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr/nixexpr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/libexpr/nixexpr.cc')
-rw-r--r--third_party/nix/src/libexpr/nixexpr.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/third_party/nix/src/libexpr/nixexpr.cc b/third_party/nix/src/libexpr/nixexpr.cc
index faf1020f8573..94e7d335cff0 100644
--- a/third_party/nix/src/libexpr/nixexpr.cc
+++ b/third_party/nix/src/libexpr/nixexpr.cc
@@ -18,7 +18,7 @@ std::ostream& operator<<(std::ostream& str, const Expr& e) {
 
 static void showString(std::ostream& str, const std::string& s) {
   str << '"';
-  for (auto c : std::string(s)) {
+  for (auto c : (std::string)s) {
     if (c == '"' || c == '\\' || c == '$') {
       str << "\\" << c;
     } else if (c == '\n') {
@@ -191,7 +191,7 @@ std::ostream& operator<<(std::ostream& str, const Pos& pos) {
     str << "undefined position";
   } else {
     str << (format(ANSI_BOLD "%1%" ANSI_NORMAL ":%2%:%3%") %
-            std::string(pos.file.value()) % pos.line % pos.column)
+            (std::string)pos.file.value() % pos.line % pos.column)
                .str();
   }
   return str;
@@ -232,8 +232,8 @@ void ExprPath::bindVars(const StaticEnv& env) {}
 void ExprVar::bindVars(const StaticEnv& env) {
   /* Check whether the variable appears in the environment.  If so,
      set its level and displacement. */
-  const StaticEnv* curEnv = nullptr;
-  unsigned int level = 0;
+  const StaticEnv* curEnv;
+  unsigned int level;
   int withLevel = -1;
   for (curEnv = &env, level = 0; curEnv != nullptr;
        curEnv = curEnv->up, level++) {
@@ -363,8 +363,8 @@ void ExprWith::bindVars(const StaticEnv& env) {
   /* Does this `with' have an enclosing `with'?  If so, record its
      level so that `lookupVar' can look up variables in the previous
      `with' if this one doesn't contain the desired attribute. */
-  const StaticEnv* curEnv = nullptr;
-  unsigned int level = 0;
+  const StaticEnv* curEnv;
+  unsigned int level;
   prevWith = 0;
   for (curEnv = &env, level = 1; curEnv != nullptr;
        curEnv = curEnv->up, level++) {
@@ -405,7 +405,7 @@ void ExprLambda::setName(Symbol& name) { this->name = name; }
 
 std::string ExprLambda::showNamePos() const {
   return (format("%1% at %2%") %
-          (name.has_value() ? "'" + std::string(name.value()) + "'"
+          (name.has_value() ? "'" + (std::string)name.value() + "'"
                             : "anonymous function") %
           pos)
       .str();