Enable readability-redundant-control-flow checks
These checks are a nice addition to our static analysis, as they
simplify code quite a bit, as can be seen by this diff being negative
lines.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I60ede4ad23d7e5337e811d70ddcab24bf8986891
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index 0ea4887..0ed0bbc 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -104,12 +104,7 @@
}
}
}
- if (count < index)
- {
- return false;
- }
-
- return true;
+ return count >= index;
}
template <typename Callback>
diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp
index 4434e1f..10f0a9a 100644
--- a/include/ibm/locks.hpp
+++ b/include/ibm/locks.hpp
@@ -544,12 +544,7 @@
BMCWEB_LOG_DEBUG << "Comparing bytes " << std::to_string(pPosition) << ","
<< std::to_string(qPosition);
- if (pPosition != qPosition)
- {
- return false;
- }
-
- return true;
+ return pPosition == qPosition;
}
inline bool Lock::isConflictRecord(const LockRequest& refLockRecord1,
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index 57c9d83..876ceb3 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -257,7 +257,6 @@
asyncResp->res.jsonValue["Actions"]["#IBMConfigFiles.DeleteAll"] = {
{"target",
"/ibm/v1/Host/ConfigFiles/Actions/IBMConfigFiles.DeleteAll"}};
- return;
}
inline void
@@ -280,7 +279,6 @@
<< ec;
}
}
- return;
}
inline void
@@ -297,7 +295,6 @@
{"target", "/ibm/v1/HMC/LockService/Actions/LockService.ReleaseLock"}};
asyncResp->res.jsonValue["Actions"]["#LockService.GetLockList"] = {
{"target", "/ibm/v1/HMC/LockService/Actions/LockService.GetLockList"}};
- return;
}
inline void handleFileGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
@@ -330,7 +327,6 @@
fileData = {std::istreambuf_iterator<char>(readfile),
std::istreambuf_iterator<char>()};
asyncResp->res.jsonValue["Data"] = fileData;
- return;
}
inline void
@@ -362,7 +358,6 @@
asyncResp->res.result(boost::beast::http::status::not_found);
asyncResp->res.jsonValue["Description"] = resourceNotFoundMsg;
}
- return;
}
inline void
@@ -385,7 +380,6 @@
return;
}
redfish::EventServiceManager::getInstance().sendBroadcastMsg(broadcastMsg);
- return;
}
inline void handleFileUrl(const crow::Request& req,
@@ -545,7 +539,6 @@
{
crow::ibm_mc_lock::Lock::getInstance().releaseLock(req.session->uniqueId);
asyncResp->res.result(boost::beast::http::status::ok);
- return;
}
inline void
@@ -603,7 +596,6 @@
returnJson["SegmentFlags"] = myArray;
asyncResp->res.jsonValue["Record"] = returnJson;
- return;
}
inline void
diff --git a/include/login_routes.hpp b/include/login_routes.hpp
index 858968b..c918cdd 100644
--- a/include/login_routes.hpp
+++ b/include/login_routes.hpp
@@ -253,7 +253,6 @@
persistent_data::SessionStore::getInstance().removeSession(
session);
}
- return;
});
}
} // namespace login_routes