clang-tidy: Enable readability-simplify-boolean-expr check
This checks for boolean expressions involving boolean constants
and simplifies them to use the appropriate boolean expression
directly.
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: If2316dc52cbd280971f0333ee805b11e1b99d27f
diff --git a/.clang-tidy b/.clang-tidy
index 17375d0..7a042f3 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -273,6 +273,7 @@
readability-redundant-preprocessor,
readability-redundant-smartptr-get,
readability-redundant-string-init,
+readability-simplify-boolean-expr,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
diff --git a/manager/json-config.hpp b/manager/json-config.hpp
index 7d94f20..089879d 100644
--- a/manager/json-config.hpp
+++ b/manager/json-config.hpp
@@ -80,7 +80,7 @@
}
return false;
});
- return it == names.end() ? false : true;
+ return it != names.end();
}
/**
diff --git a/manager/manager.hpp b/manager/manager.hpp
index 045586f..1f5f0a5 100644
--- a/manager/manager.hpp
+++ b/manager/manager.hpp
@@ -49,14 +49,7 @@
// this case its {fan0, 1, 1}
if (left.name == right.name)
{
- if (left.action == right.action)
- {
- return false;
- }
- else
- {
- return true;
- }
+ return left.action != right.action;
}
return left.name < right.name;
}
diff --git a/manager/serialize.cpp b/manager/serialize.cpp
index 64bcadf..e11bb95 100644
--- a/manager/serialize.cpp
+++ b/manager/serialize.cpp
@@ -32,7 +32,7 @@
// If the name of asserted group exist in the archive and the Asserted
// property is false, entry is removed from the archive.
auto iter = savedGroups.find(group);
- if (iter != savedGroups.end() && asserted == false)
+ if (iter != savedGroups.end() && !asserted)
{
savedGroups.erase(iter);
}