diff options
Diffstat (limited to 'third_party/nix/src/nix/search.cc')
-rw-r--r-- | third_party/nix/src/nix/search.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/third_party/nix/src/nix/search.cc b/third_party/nix/src/nix/search.cc index 78a1f21bc1e2..5f6def220291 100644 --- a/third_party/nix/src/nix/search.cc +++ b/third_party/nix/src/nix/search.cc @@ -160,11 +160,11 @@ struct CmdSearch : SourceExprCommand, MixJSON { } } - if (cache) { + if (cache != nullptr) { cache->attr("type", "derivation"); cache->attr("name", drv.queryName()); cache->attr("system", drv.querySystem()); - if (description != "") { + if (!description.empty()) { auto meta(cache->object("meta")); meta.attr("description", description); } @@ -190,11 +190,12 @@ struct CmdSearch : SourceExprCommand, MixJSON { for (auto& i : *v->attrs) { auto cache2 = - cache ? std::make_unique<JSONObject>(cache->object(i.name)) - : nullptr; + cache != nullptr + ? std::make_unique<JSONObject>(cache->object(i.name)) + : nullptr; doExpr(i.value, - attrPath == "" ? (std::string)i.name - : attrPath + "." + (std::string)i.name, + attrPath.empty() ? (std::string)i.name + : attrPath + "." + (std::string)i.name, toplevel2 || fromCache, cache2 ? cache2.get() : nullptr); } } @@ -256,7 +257,7 @@ struct CmdSearch : SourceExprCommand, MixJSON { } } - if (results.size() == 0) { + if (results.empty()) { throw Error("no results for the given search term(s)!"); } |