diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-20T21·27+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-20T21·27+0100 |
commit | 689ef502f5b0655c9923ed77da2ae3504630f473 (patch) | |
tree | 3e331c153646f136875f047cc3b9f0aad8c86341 /third_party/nix/src/libexpr/nixexpr.cc | |
parent | d331d3a0b5c497a46e2636f308234be66566c04c (diff) |
refactor(3p/nix): Apply clang-tidy's readability-* fixes r/788
This applies the readability fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html
Diffstat (limited to 'third_party/nix/src/libexpr/nixexpr.cc')
-rw-r--r-- | third_party/nix/src/libexpr/nixexpr.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/third_party/nix/src/libexpr/nixexpr.cc b/third_party/nix/src/libexpr/nixexpr.cc index 55b9d545778c..22be923404a0 100644 --- a/third_party/nix/src/libexpr/nixexpr.cc +++ b/third_party/nix/src/libexpr/nixexpr.cc @@ -73,7 +73,7 @@ void ExprVar::show(std::ostream& str) const { str << name; } void ExprSelect::show(std::ostream& str) const { str << "(" << *e << ")." << showAttrPath(attrPath); - if (def) { + if (def != nullptr) { str << " or (" << *def << ")"; } } @@ -121,7 +121,7 @@ void ExprLambda::show(std::ostream& str) const { str << ", "; } str << i.name; - if (i.def) { + if (i.def != nullptr) { str << " ? " << *i.def; } } @@ -233,7 +233,8 @@ void ExprVar::bindVars(const StaticEnv& env) { const StaticEnv* curEnv; unsigned int level; int withLevel = -1; - for (curEnv = &env, level = 0; curEnv; curEnv = curEnv->up, level++) { + for (curEnv = &env, level = 0; curEnv != nullptr; + curEnv = curEnv->up, level++) { if (curEnv->isWith) { if (withLevel == -1) { withLevel = level; @@ -263,7 +264,7 @@ void ExprVar::bindVars(const StaticEnv& env) { void ExprSelect::bindVars(const StaticEnv& env) { e->bindVars(env); - if (def) { + if (def != nullptr) { def->bindVars(env); } for (auto& i : attrPath) { @@ -332,7 +333,7 @@ void ExprLambda::bindVars(const StaticEnv& env) { } for (auto& i : formals->formals) { - if (i.def) { + if (i.def != nullptr) { i.def->bindVars(newEnv); } } @@ -363,7 +364,8 @@ void ExprWith::bindVars(const StaticEnv& env) { const StaticEnv* curEnv; unsigned int level; prevWith = 0; - for (curEnv = &env, level = 1; curEnv; curEnv = curEnv->up, level++) { + for (curEnv = &env, level = 1; curEnv != nullptr; + curEnv = curEnv->up, level++) { if (curEnv->isWith) { prevWith = level; break; |