[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

@@ -208,8 +208,8 @@ std::string taskInfoDifferences (
if (name != "uuid" &&
name != "modified" &&
before.get (name) != after.get (name) &&
before.get (name) != "" &&
after.get (name) != "")
!before.get (name).empty() &&
!after.get (name).empty())
{
if (name == "depends")
{
@@ -245,10 +245,10 @@ std::string renderAttribute (const std::string& name, const std::string& value,
Column* col = Context::getContext ().columns[name];
if (col &&
col->type () == "date" &&
value != "")
!value.empty())
{
Datetime d ((time_t)strtol (value.c_str (), nullptr, 10));
if (format == "")
if (format.empty())
return d.toString (Context::getContext ().config.get ("dateformat"));
return d.toString (format);
@@ -379,7 +379,7 @@ void feedback_unblocked (const Task& task)
for (auto& i : blocked)
{
auto blocking = dependencyGetBlocking (i);
if (blocking.size () == 0)
if (blocking.empty())
{
if (i.id)
std::cout << format ("Unblocked {1} '{2}'.",
@@ -402,7 +402,7 @@ void feedback_unblocked (const Task& task)
///////////////////////////////////////////////////////////////////////////////
void feedback_backlog ()
{
if (Context::getContext ().config.get ("taskd.server") != "" &&
if (!Context::getContext ().config.get ("taskd.server").empty() &&
Context::getContext ().verbose ("sync"))
{
int count = 0;
@@ -423,7 +423,7 @@ std::string onProjectChange (Task& task, bool scope /* = true */)
std::stringstream msg;
std::string project = task.get ("project");
if (project != "")
if (!project.empty())
{
if (scope)
msg << format ("The project '{1}' has changed.", project)