Enable readability-container-size-empty tests
This one is a little trivial, but it does help in readability.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I5366d4eec8af2f781b3bad804131ae2eb806e3aa
diff --git a/include/dbus_monitor.hpp b/include/dbus_monitor.hpp
index c8e46b7..9bc79ad 100644
--- a/include/dbus_monitor.hpp
+++ b/include/dbus_monitor.hpp
@@ -200,7 +200,7 @@
"member='PropertiesChanged'");
// If interfaces weren't specified, add a single match for all
// interfaces
- if (thisSession.interfaces.size() == 0)
+ if (thisSession.interfaces.empty())
{
BMCWEB_LOG_DEBUG << "Creating match "
<< propertiesMatchString;
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index 75bda08..0ea4887 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -122,7 +122,7 @@
[callback{std::forward<Callback>(callback)}](
const boost::system::error_code ec,
const GetObjectType& objectNames) {
- callback(!ec && objectNames.size() != 0);
+ callback(!ec && !objectNames.empty());
},
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp
index 5a86d09..45525bf 100644
--- a/include/ibm/locks.hpp
+++ b/include/ibm/locks.hpp
@@ -299,7 +299,7 @@
auto it = lockTable.begin();
while (it != lockTable.end())
{
- if (it->second.size() != 0)
+ if (!it->second.empty())
{
// Check if session id of this entry matches with session id
// given
diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp
index ed5265d..3f97f8c 100644
--- a/include/nbd_proxy.hpp
+++ b/include/nbd_proxy.hpp
@@ -193,7 +193,7 @@
return;
}
- if (ws2uxBuf.size() == 0)
+ if (ws2uxBuf.empty())
{
BMCWEB_LOG_ERROR << "No data to write to UNIX socket";
return;
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index abcec1a..9233a27 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -1562,7 +1562,7 @@
const boost::system::error_code ec,
const std::vector<std::pair<std::string, std::vector<std::string>>>&
interfaceNames) {
- if (ec || interfaceNames.size() <= 0)
+ if (ec || interfaceNames.empty())
{
BMCWEB_LOG_ERROR << "Can't find object";
setErrorResponse(transaction->res,
@@ -1596,7 +1596,7 @@
const boost::system::error_code ec,
const std::vector<std::pair<std::string, std::vector<std::string>>>&
interfaceNames) {
- if (ec || interfaceNames.size() <= 0)
+ if (ec || interfaceNames.empty())
{
BMCWEB_LOG_ERROR << "Can't find object";
setErrorResponse(asyncResp->res,
@@ -1701,7 +1701,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp, path, propertyName](const boost::system::error_code ec,
const GetObjectType& objectNames) {
- if (ec || objectNames.size() <= 0)
+ if (ec || objectNames.empty())
{
setErrorResponse(asyncResp->res,
boost::beast::http::status::not_found,
@@ -1718,7 +1718,7 @@
const std::vector<std::string>& interfaceNames =
connection.second;
- if (interfaceNames.size() <= 0)
+ if (interfaceNames.empty())
{
setErrorResponse(asyncResp->res,
boost::beast::http::status::not_found,
@@ -1875,7 +1875,7 @@
crow::connections::systemBus->async_method_call(
[transaction](const boost::system::error_code ec2,
const GetObjectType& objectNames) {
- if (!ec2 && objectNames.size() <= 0)
+ if (!ec2 && objectNames.empty())
{
setErrorResponse(transaction->asyncResp->res,
boost::beast::http::status::not_found,
diff --git a/include/webassets.hpp b/include/webassets.hpp
index f92214f..8f41f2f 100644
--- a/include/webassets.hpp
+++ b/include/webassets.hpp
@@ -102,8 +102,7 @@
if (boost::starts_with(webpath.filename().string(), "index."))
{
webpath = webpath.parent_path();
- if (webpath.string().size() == 0 ||
- webpath.string().back() != '/')
+ if (webpath.string().empty() || webpath.string().back() != '/')
{
// insert the non-directory version of this path
webroutes::routes.insert(webpath);