clang-tidy: Enable performance-move-const-arg check
The check warns:
- if std::move() is called with a constant argument.
- if std::move() is called with an argument of a trivially-copyable
type.
- if the result of std::move() is passed as a const reference
argument.
In all three cases, the check will suggest a fix that removes the
std::move().
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: Ibaf1050b39bbcaddd27473c6f2009adbfb96125f
diff --git a/.clang-tidy b/.clang-tidy
index 9dac9db..190d32f 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -232,6 +232,7 @@
performance-inefficient-algorithm,
performance-inefficient-string-concatenation,
performance-inefficient-vector-operation,
+performance-move-const-arg,
performance-move-constructor-init,
performance-no-automatic-move,
performance-no-int-to-ptr,
diff --git a/manager/lamptest/lamptest.cpp b/manager/lamptest/lamptest.cpp
index 6f24973..e7c9d5a 100644
--- a/manager/lamptest/lamptest.cpp
+++ b/manager/lamptest/lamptest.cpp
@@ -253,7 +253,7 @@
{
if (groupObj == nullptr)
{
- groupObj = std::move(group);
+ groupObj = group;
}
if (value)