Skip to content

Commit

Permalink
tools: fix redundant-move warning in inspector
Browse files Browse the repository at this point in the history
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::Value>
    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: #32685
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Matheus Marchini <[email protected]>
  • Loading branch information
danbev authored and targos committed May 7, 2020
1 parent 6a6d58b commit 8970d22
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/inspector_protocol/lib/Values_cpp.template
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ std::unique_ptr<Value> DictionaryValue::clone() const
DCHECK(value != m_data.cend() && value->second);
result->setValue(key, value->second->clone());
}
return std::move(result);
return result;
}

DictionaryValue::DictionaryValue()
Expand Down Expand Up @@ -647,7 +647,7 @@ std::unique_ptr<Value> ListValue::clone() const
std::unique_ptr<ListValue> result = ListValue::create();
for (const std::unique_ptr<protocol::Value>& value : m_data)
result->pushValue(value->clone());
return std::move(result);
return result;
}

ListValue::ListValue()
Expand Down

0 comments on commit 8970d22

Please sign in to comment.