src: Remove unnecessary std::move to allow copy elision
Change-Id: I1a83c762dfc51525affd5b01a3c4822b9579c57a
Refs: #3357
diff --git a/src/exclude.cpp b/src/exclude.cpp
index bd4d4d7..300aed7 100644
--- a/src/exclude.cpp
+++ b/src/exclude.cpp
@@ -120,7 +120,7 @@
while (i != m_wire.elements_end()) {
name::Component excludedComponent;
try {
- excludedComponent = std::move(name::Component(*i));
+ excludedComponent = name::Component(*i);
}
catch (const name::Component::Error&) {
BOOST_THROW_EXCEPTION(Error("Incorrect format of Exclude filter"));
diff --git a/src/name.cpp b/src/name.cpp
index 2e2dd6c..0e1b11c 100644
--- a/src/name.cpp
+++ b/src/name.cpp
@@ -170,13 +170,13 @@
void
Name::set(const char* uri)
{
- *this = std::move(Name(uri));
+ *this = Name(uri);
}
void
Name::set(const std::string& uri)
{
- *this = std::move(Name(uri));
+ *this = Name(uri);
}
std::string
@@ -371,7 +371,7 @@
{
std::string inputString;
is >> inputString;
- name = std::move(Name(inputString));
+ name = Name(inputString);
return is;
}
diff --git a/src/security/identity.cpp b/src/security/identity.cpp
index 1093b9f..9b42ec5 100644
--- a/src/security/identity.cpp
+++ b/src/security/identity.cpp
@@ -103,7 +103,7 @@
validityCheck();
if (m_needRefreshKeys) {
- m_keys = std::move(KeyContainer(m_name, m_impl->getKeysOfIdentity(m_name), m_impl));
+ m_keys = KeyContainer(m_name, m_impl->getKeysOfIdentity(m_name), m_impl);
m_needRefreshKeys = false;
}
@@ -115,7 +115,7 @@
{
validityCheck();
- m_defaultKey = std::move(Key(m_name, keyId, m_impl));
+ m_defaultKey = Key(m_name, keyId, m_impl);
m_hasDefaultKey = true;
m_impl->setDefaultKeyOfIdentity(m_name, keyId);
@@ -135,7 +135,7 @@
validityCheck();
if (!m_hasDefaultKey) {
- m_defaultKey = std::move(Key(m_name, m_impl->getDefaultKeyOfIdentity(m_name), m_impl));
+ m_defaultKey = Key(m_name, m_impl->getDefaultKeyOfIdentity(m_name), m_impl);
m_hasDefaultKey = true;
}
diff --git a/src/security/key.cpp b/src/security/key.cpp
index 48c8aa3..3d91cad 100644
--- a/src/security/key.cpp
+++ b/src/security/key.cpp
@@ -140,8 +140,7 @@
validityCheck();
if (m_needRefreshCerts) {
- m_certificates = std::move(CertificateContainer(m_impl->getCertificatesOfKey(m_id, m_keyId),
- m_impl));
+ m_certificates = CertificateContainer(m_impl->getCertificatesOfKey(m_id, m_keyId), m_impl);
m_needRefreshCerts = false;
}
diff --git a/src/security/pib.cpp b/src/security/pib.cpp
index fd392f6..df366c9 100644
--- a/src/security/pib.cpp
+++ b/src/security/pib.cpp
@@ -87,7 +87,7 @@
Pib::getIdentities() const
{
if (m_needRefreshIdentities) {
- m_identities = std::move(IdentityContainer(m_impl->getIdentities(), m_impl));
+ m_identities = IdentityContainer(m_impl->getIdentities(), m_impl);
m_needRefreshIdentities = false;
}
@@ -108,7 +108,7 @@
Pib::getDefaultIdentity() const
{
if (!m_hasDefaultIdentity) {
- m_defaultIdentity = std::move(Identity(m_impl->getDefaultIdentity(), m_impl, false));
+ m_defaultIdentity = Identity(m_impl->getDefaultIdentity(), m_impl, false);
m_hasDefaultIdentity = true;
}
diff --git a/tests/unit-tests/name.t.cpp b/tests/unit-tests/name.t.cpp
index 96732fd..3d0d02e 100644
--- a/tests/unit-tests/name.t.cpp
+++ b/tests/unit-tests/name.t.cpp
@@ -164,7 +164,7 @@
BOOST_CHECK(nameEncoded == nameBlock);
Name name2;
- BOOST_REQUIRE_NO_THROW(name2 = std::move(Name(nameUri)));
+ BOOST_REQUIRE_NO_THROW(name2 = Name(nameUri));
BOOST_CHECK_EQUAL(name2.toUri(), nameUri);
Block name2Encoded = name2.wireEncode();
BOOST_CHECK(name2Encoded == nameBlock);