From a87d3710148c0d1128e5372a1a8b90edd174a65d Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 6 Apr 2020 14:21:08 +0200 Subject: [PATCH] tools: fix redundant-move warning in inspector MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, the following warning is generated from the inspector protocol: /out/Release/obj/gen/src/node/inspector/protocol/Protocol.cpp: In member function ‘virtual std::unique_ptr node::inspector::protocol::ListValue::clone() const’: /out/Release/obj/gen/src/node/inspector/protocol/Protocol.cpp:739:21: error: redundant move in return statement [-Werror=redundant-move] 739 | return std::move(result); | ~~~~~~~~~^~~~~~~~ This commit removes the move for DictionaryValue and ListValue. PR-URL: https://github.com/nodejs/node/pull/32685 Reviewed-By: Richard Lau Reviewed-By: Anna Henningsen Reviewed-By: Matheus Marchini --- tools/inspector_protocol/lib/Values_cpp.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/inspector_protocol/lib/Values_cpp.template b/tools/inspector_protocol/lib/Values_cpp.template index 764b4d37d9a7d5..be3149d50356f2 100644 --- a/tools/inspector_protocol/lib/Values_cpp.template +++ b/tools/inspector_protocol/lib/Values_cpp.template @@ -606,7 +606,7 @@ std::unique_ptr DictionaryValue::clone() const DCHECK(value != m_data.cend() && value->second); result->setValue(key, value->second->clone()); } - return std::move(result); + return result; } DictionaryValue::DictionaryValue() @@ -647,7 +647,7 @@ std::unique_ptr ListValue::clone() const std::unique_ptr result = ListValue::create(); for (const std::unique_ptr& value : m_data) result->pushValue(value->clone()); - return std::move(result); + return result; } ListValue::ListValue()