Add readability-redundant-* checks
There's a number of redundancies in our code that clang can sanitize
out. Fix the existing problems, and enable the checks.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Ie63d7b7f0777b702fbf1b23a24e1bed7b4f5183b
diff --git a/include/authorization.hpp b/include/authorization.hpp
index 27d7b32..f8e74b9 100644
--- a/include/authorization.hpp
+++ b/include/authorization.hpp
@@ -85,7 +85,7 @@
// needed.
// This whole flow needs to be revisited anyway, as we can't be
// calling directly into pam for every request
- std::string unsupportedClientId = "";
+ std::string unsupportedClientId;
return persistent_data::SessionStore::getInstance().generateUserSession(
user, clientIp, unsupportedClientId,
persistent_data::PersistenceType::SINGLE_REQUEST, isConfigureSelfOnly);
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index e80e727..39146c9 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -512,7 +512,8 @@
asyncResp->res.result(boost::beast::http::status::conflict);
auto var =
std::get<std::pair<uint32_t, LockRequest>>(conflictStatus.second);
- nlohmann::json returnJson, segments;
+ nlohmann::json returnJson;
+ nlohmann::json segments;
nlohmann::json myarray = nlohmann::json::array();
returnJson["TransactionID"] = var.first;
returnJson["SessionID"] = std::get<0>(var.second);
@@ -579,7 +580,8 @@
asyncResp->res.result(boost::beast::http::status::unauthorized);
auto var = statusRelease.second;
- nlohmann::json returnJson, segments;
+ nlohmann::json returnJson;
+ nlohmann::json segments;
nlohmann::json myArray = nlohmann::json::array();
returnJson["TransactionID"] = var.first;
returnJson["SessionID"] = std::get<0>(var.second);
diff --git a/include/login_routes.hpp b/include/login_routes.hpp
index c918cdd..1087b0b 100644
--- a/include/login_routes.hpp
+++ b/include/login_routes.hpp
@@ -185,7 +185,7 @@
}
else
{
- std::string unsupportedClientId = "";
+ std::string unsupportedClientId;
auto session =
persistent_data::SessionStore::getInstance()
.generateUserSession(
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index 8aab757..6861571 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -2044,7 +2044,7 @@
// If accessing a single attribute, fill in and update objectPath,
// otherwise leave destProperty blank
- std::string destProperty = "";
+ std::string destProperty;
const char* attrSeperator = "/attr/";
size_t attrPosition = objectPath.find(attrSeperator);
if (attrPosition != objectPath.npos)
diff --git a/include/persistent_data.hpp b/include/persistent_data.hpp
index 47bb8a9..02f2cce 100644
--- a/include/persistent_data.hpp
+++ b/include/persistent_data.hpp
@@ -289,7 +289,7 @@
persistentFile << data;
}
- std::string systemUuid{""};
+ std::string systemUuid;
};
inline ConfigFile& getConfig()