refactor(3p/nix): Apply clang-tidy's readability-* fixes
This applies the readability fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html
This commit is contained in:
parent
d331d3a0b5
commit
689ef502f5
78 changed files with 863 additions and 792 deletions
14
third_party/nix/src/libexpr/nixexpr.cc
vendored
14
third_party/nix/src/libexpr/nixexpr.cc
vendored
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue