diff options
author | Rosen Penev <rosenp@gmail.com> | 2020-06-04 07:47:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-04 07:47:37 (GMT) |
commit | be6c7afcd1eb87b150a285043520d46d23674070 (patch) | |
tree | eaf967a820dd838f729aa5a27f16b471a2fc9792 /src | |
parent | a32a2087b65e9e858fbd1450555108bfda95adfb (diff) | |
download | Ninja-be6c7afcd1eb87b150a285043520d46d23674070.zip Ninja-be6c7afcd1eb87b150a285043520d46d23674070.tar.gz Ninja-be6c7afcd1eb87b150a285043520d46d23674070.tar.bz2 |
[clang-tidy] check empty instead of size (#1784)
Found with readability-container-size-empty
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/build.cc | 2 | ||||
-rw-r--r-- | src/build_test.cc | 2 | ||||
-rw-r--r-- | src/deps_log.cc | 2 | ||||
-rw-r--r-- | src/string_piece_util.cc | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/src/build.cc b/src/build.cc index cd8df4e..a16593b 100644 --- a/src/build.cc +++ b/src/build.cc @@ -1033,7 +1033,7 @@ bool Builder::FinishCommand(CommandRunner::Result* result, string* err) { } if (!deps_type.empty() && !config_.dry_run) { - assert(edge->outputs_.size() >= 1 && "should have been rejected by parser"); + assert(!edge->outputs_.empty() && "should have been rejected by parser"); for (std::vector<Node*>::const_iterator o = edge->outputs_.begin(); o != edge->outputs_.end(); ++o) { TimeStamp deps_mtime = disk_interface_->Stat((*o)->path(), err); diff --git a/src/build_test.cc b/src/build_test.cc index 426e825..12c3383 100644 --- a/src/build_test.cc +++ b/src/build_test.cc @@ -672,7 +672,7 @@ bool FakeCommandRunner::WaitForCommand(Result* result) { bool verify_active_edge_found = false; for (vector<Edge*>::iterator i = active_edges_.begin(); i != active_edges_.end(); ++i) { - if ((*i)->outputs_.size() >= 1 && + if (!(*i)->outputs_.empty() && (*i)->outputs_[0]->path() == verify_active_edge) { verify_active_edge_found = true; } diff --git a/src/deps_log.cc b/src/deps_log.cc index cf55194..59a1956 100644 --- a/src/deps_log.cc +++ b/src/deps_log.cc @@ -399,7 +399,7 @@ bool DepsLog::RecordId(Node* node) { if (fwrite(&size, 4, 1, file_) < 1) return false; if (fwrite(node->path().data(), path_size, 1, file_) < 1) { - assert(node->path().size() > 0); + assert(!node->path().empty()); return false; } if (padding && fwrite("\0\0", padding, 1, file_) < 1) diff --git a/src/string_piece_util.cc b/src/string_piece_util.cc index 8e1ecfd..69513f5 100644 --- a/src/string_piece_util.cc +++ b/src/string_piece_util.cc @@ -39,7 +39,7 @@ vector<StringPiece> SplitStringPiece(StringPiece input, char sep) { } string JoinStringPiece(const vector<StringPiece>& list, char sep) { - if (list.size() == 0){ + if (list.empty()) { return ""; } |