[clang-tidy] Use .empty instead of comparing size

Found with readability-container-size-empty

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2019-09-27 19:12:49 -07:00
committed by Paul Beckingham
parent d43fa66489
commit a331cceded
18 changed files with 132 additions and 132 deletions

View File

@@ -135,7 +135,7 @@ void Hooks::onLaunch () const
Timer timer;
std::vector <std::string> matchingScripts = scripts ("on-launch");
if (matchingScripts.size ())
if (!matchingScripts.empty())
{
for (auto& script : matchingScripts)
{
@@ -188,7 +188,7 @@ void Hooks::onExit () const
Timer timer;
std::vector <std::string> matchingScripts = scripts ("on-exit");
if (matchingScripts.size ())
if (!matchingScripts.empty())
{
// Get the set of changed tasks.
std::vector <Task> tasks;
@@ -250,7 +250,7 @@ void Hooks::onAdd (Task& task) const
Timer timer;
std::vector <std::string> matchingScripts = scripts ("on-add");
if (matchingScripts.size ())
if (!matchingScripts.empty())
{
// Convert task to a vector of strings.
std::vector <std::string> input;
@@ -316,7 +316,7 @@ void Hooks::onModify (const Task& before, Task& after) const
Timer timer;
std::vector <std::string> matchingScripts = scripts ("on-modify");
if (matchingScripts.size ())
if (!matchingScripts.empty())
{
// Convert vector of tasks to a vector of strings.
std::vector <std::string> input;
@@ -601,7 +601,7 @@ int Hooks::callHookScript (
{
Context::getContext ().debug ("Hook: output");
for (const auto& i : output)
if (i != "")
if (!i.empty())
Context::getContext ().debug (" " + i);
Context::getContext ().debug (format ("Hook: Completed with status {1}", status));