Skip to content

Commit

Permalink
clang-tidy: use container empty() method where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 committed Nov 10, 2024
1 parent 80af76d commit fd76732
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ Checks:
- modernize-*
- readability-braces-around-statements
- readability-else-after-return
- readability-container-size-empty
- cppcoreguidelines-pro-type-cstyle-cast
UseColor: true
4 changes: 2 additions & 2 deletions src/nix-eval-jobs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,11 @@ auto main(int argc, char **argv) -> int {
evalSettings.pureEval = true;
}

if (myArgs.releaseExpr == "") {
if (myArgs.releaseExpr.empty()) {
throw UsageError("no expression specified");
}

if (myArgs.gcRootsDir == "") {
if (myArgs.gcRootsDir.empty()) {
printMsg(lvlError, "warning: `--gc-roots-dir' not specified");
} else {
myArgs.gcRootsDir = std::filesystem::absolute(myArgs.gcRootsDir);
Expand Down
6 changes: 3 additions & 3 deletions src/worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void worker(nix::ref<nix::EvalState> state, nix::Bindings &autoArgs,
/* Register the derivation as a GC root. !!! This
registers roots for jobs that we may have already
done. */
if (args.gcRootsDir != "") {
if (args.gcRootsDir.empty()) {
nix::Path root =
args.gcRootsDir + "/" +
std::string(nix::baseNameOf(drv.drvPath));
Expand All @@ -159,8 +159,8 @@ void worker(nix::ref<nix::EvalState> state, nix::Bindings &autoArgs,
auto attrs = nlohmann::json::array();
bool recurse =
args.forceRecurse ||
path.size() == 0; // Dont require `recurseForDerivations
// = true;` for top-level attrset
path.empty(); // Dont require `recurseForDerivations
// = true;` for top-level attrset

for (auto &i :
v->attrs()->lexicographicOrder(state->symbols)) {
Expand Down

0 comments on commit fd76732

Please sign in to comment.