Fix moves/forward

Clang has new checks for std::move/std::forward correctness, which
catches quite a few "wrong" things where we were making copies of
callback handlers.

Unfortunately, the lambda syntax of

callback{std::forward<Callback>(callback)}

in a capture confuses it, so change usages to
callback = std::forward<Callback>(callback)

to be consistent.

Tested: Redfish service validator passes.

Change-Id: I7a111ec00cf78ecb7d5f5b102c786c1c14d74384
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/include/async_resolve.hpp b/include/async_resolve.hpp
index 805fbad..798c3e8 100644
--- a/include/async_resolve.hpp
+++ b/include/async_resolve.hpp
@@ -83,7 +83,7 @@
         uint64_t flag = 0;
         crow::connections::systemBus->async_method_call(
             [host{std::string(host)}, portNum,
-             handler{std::forward<ResolveHandler>(handler)}](
+             handler = std::forward<ResolveHandler>(handler)](
                 const boost::system::error_code& ec,
                 const std::vector<
                     std::tuple<int32_t, int32_t, std::vector<uint8_t>>>& resp,
diff --git a/include/dbus_privileges.hpp b/include/dbus_privileges.hpp
index b2bb1e3..a58f9be 100644
--- a/include/dbus_privileges.hpp
+++ b/include/dbus_privileges.hpp
@@ -109,7 +109,7 @@
 template <typename CallbackFn>
 void afterGetUserInfo(Request& req,
                       const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                      BaseRule& rule, CallbackFn&& callback,
+                      BaseRule& rule, CallbackFn callback,
                       const boost::system::error_code& ec,
                       const dbus::utility::DBusPropertiesMap& userInfoMap)
 {
@@ -151,7 +151,7 @@
     std::string username = req.session->username;
     crow::connections::systemBus->async_method_call(
         [req{std::move(req)}, asyncResp, &rule,
-         callback(std::forward<CallbackFn>(callback))](
+         callback = std::forward<CallbackFn>(callback)](
             const boost::system::error_code& ec,
             const dbus::utility::DBusPropertiesMap& userInfoMap) mutable {
         afterGetUserInfo(req, asyncResp, rule,
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index 933d733..c06ba9e 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -147,7 +147,7 @@
 inline void checkDbusPathExists(const std::string& path, Callback&& callback)
 {
     crow::connections::systemBus->async_method_call(
-        [callback{std::forward<Callback>(callback)}](
+        [callback = std::forward<Callback>(callback)](
             const boost::system::error_code& ec,
             const dbus::utility::MapperGetObject& objectNames) {
         callback(!ec && !objectNames.empty());
diff --git a/include/google/google_service_root.hpp b/include/google/google_service_root.hpp
index 9dd2405..00c5e36 100644
--- a/include/google/google_service_root.hpp
+++ b/include/google/google_service_root.hpp
@@ -104,8 +104,7 @@
         "xyz.openbmc_project.Control.Hoth"};
     dbus::utility::getSubTree(
         "/xyz/openbmc_project", 0, hothIfaces,
-        [command, asyncResp, rotId,
-         entityHandler{std::forward<ResolvedEntityHandler>(entityHandler)}](
+        [command, asyncResp, rotId, entityHandler{std::move(entityHandler)}](
             const boost::system::error_code& ec,
             const dbus::utility::MapperGetSubTreeResponse& subtree) {
         hothGetSubtreeCallback(command, asyncResp, rotId, entityHandler, ec,