From d331d3a0b5c497a46e2636f308234be66566c04c Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 20 May 2020 04:33:07 +0100 Subject: refactor(3p/nix): Apply clang-tidy's modernize-* fixes This applies the modernization fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html The 'modernize-use-trailing-return-type' fix was excluded due to my personal preference (more specifically, I think the 'auto' keyword is misleading in that position). --- third_party/nix/src/libexpr/get-drvs.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'third_party/nix/src/libexpr/get-drvs.cc') diff --git a/third_party/nix/src/libexpr/get-drvs.cc b/third_party/nix/src/libexpr/get-drvs.cc index c62e05d4541c..aa73c01fd1f2 100644 --- a/third_party/nix/src/libexpr/get-drvs.cc +++ b/third_party/nix/src/libexpr/get-drvs.cc @@ -2,6 +2,7 @@ #include #include +#include #include @@ -11,12 +12,12 @@ namespace nix { -DrvInfo::DrvInfo(EvalState& state, const string& attrPath, Bindings* attrs) - : state(&state), attrs(attrs), attrPath(attrPath) {} +DrvInfo::DrvInfo(EvalState& state, string attrPath, Bindings* attrs) + : state(&state), attrs(attrs), attrPath(std::move(attrPath)) {} DrvInfo::DrvInfo(EvalState& state, ref store, const std::string& drvPathWithOutputs) - : state(&state), attrs(nullptr), attrPath("") { + : state(&state), attrPath("") { auto spec = parseDrvPathWithOutputs(drvPathWithOutputs); drvPath = spec.first; @@ -158,11 +159,11 @@ Bindings* DrvInfo::getMeta() { return meta; } if (!attrs) { - return 0; + return nullptr; } Bindings::iterator a = attrs->find(state->sMeta); if (a == attrs->end()) { - return 0; + return nullptr; } state->forceAttrs(*a->value, *a->pos); meta = a->value->attrs; @@ -208,11 +209,11 @@ bool DrvInfo::checkMeta(Value& v) { Value* DrvInfo::queryMeta(const string& name) { if (!getMeta()) { - return 0; + return nullptr; } Bindings::iterator a = meta->find(state->symbols.create(name)); if (a == meta->end() || !checkMeta(*a->value)) { - return 0; + return nullptr; } return a->value; } @@ -303,7 +304,7 @@ void DrvInfo::setMeta(const string& name, Value* v) { } /* Cache for already considered attrsets. */ -typedef set Done; +using Done = set; /* Evaluate value `v'. If it evaluates to a set of type `derivation', then put information about it in `drvs' (unless it's already in `done'). -- cgit 1.4.1