Commit 5d4b1cac authored by Rosen Penev's avatar Rosen Penev Committed by Facebook Github Bot

std::move improvements

Summary: Pull Request resolved: https://github.com/facebook/folly/pull/1298

Reviewed By: igorsugak

Differential Revision: D19281240

Pulled By: yfeldblum

fbshipit-source-id: 3bf437d49aa85b40923ff1ad93ba62fa97b726af
parent bedf2a2d
...@@ -222,7 +222,7 @@ IPAddress::IPAddress(StringPiece str) : addr_(), family_(AF_UNSPEC) { ...@@ -222,7 +222,7 @@ IPAddress::IPAddress(StringPiece str) : addr_(), family_(AF_UNSPEC) {
throw IPAddressFormatException( throw IPAddressFormatException(
to<std::string>("Invalid IP address '", str, "'")); to<std::string>("Invalid IP address '", str, "'"));
} }
*this = std::move(maybeIp.value()); *this = maybeIp.value();
} }
Expected<IPAddress, IPAddressFormatError> IPAddress::tryFromString( Expected<IPAddress, IPAddressFormatError> IPAddress::tryFromString(
......
...@@ -90,7 +90,7 @@ IPAddressV4::IPAddressV4(StringPiece addr) : addr_() { ...@@ -90,7 +90,7 @@ IPAddressV4::IPAddressV4(StringPiece addr) : addr_() {
throw IPAddressFormatException( throw IPAddressFormatException(
to<std::string>("Invalid IPv4 address '", addr, "'")); to<std::string>("Invalid IPv4 address '", addr, "'"));
} }
*this = std::move(maybeIp.value()); *this = maybeIp.value();
} }
Expected<IPAddressV4, IPAddressFormatError> IPAddressV4::tryFromString( Expected<IPAddressV4, IPAddressFormatError> IPAddressV4::tryFromString(
...@@ -120,7 +120,7 @@ Expected<IPAddressV4, IPAddressFormatError> IPAddressV4::tryFromBinary( ...@@ -120,7 +120,7 @@ Expected<IPAddressV4, IPAddressFormatError> IPAddressV4::tryFromBinary(
IPAddressV4 addr; IPAddressV4 addr;
auto setResult = addr.trySetFromBinary(bytes); auto setResult = addr.trySetFromBinary(bytes);
if (setResult.hasError()) { if (setResult.hasError()) {
return makeUnexpected(std::move(setResult.error())); return makeUnexpected(setResult.error());
} }
return addr; return addr;
} }
......
...@@ -76,7 +76,7 @@ IPAddressV6::IPAddressV6(StringPiece addr) { ...@@ -76,7 +76,7 @@ IPAddressV6::IPAddressV6(StringPiece addr) {
throw IPAddressFormatException( throw IPAddressFormatException(
to<std::string>("Invalid IPv6 address '", addr, "'")); to<std::string>("Invalid IPv6 address '", addr, "'"));
} }
*this = std::move(maybeIp.value()); *this = maybeIp.value();
} }
Expected<IPAddressV6, IPAddressFormatError> IPAddressV6::tryFromString( Expected<IPAddressV6, IPAddressFormatError> IPAddressV6::tryFromString(
...@@ -180,7 +180,7 @@ Expected<IPAddressV6, IPAddressFormatError> IPAddressV6::tryFromBinary( ...@@ -180,7 +180,7 @@ Expected<IPAddressV6, IPAddressFormatError> IPAddressV6::tryFromBinary(
IPAddressV6 addr; IPAddressV6 addr;
auto setResult = addr.trySetFromBinary(bytes); auto setResult = addr.trySetFromBinary(bytes);
if (setResult.hasError()) { if (setResult.hasError()) {
return makeUnexpected(std::move(setResult.error())); return makeUnexpected(setResult.error());
} }
return addr; return addr;
} }
......
...@@ -87,10 +87,7 @@ auto FiberManager::FrozenOptions::create(const Options& options) -> ssize_t { ...@@ -87,10 +87,7 @@ auto FiberManager::FrozenOptions::create(const Options& options) -> ssize_t {
FiberManager::FiberManager( FiberManager::FiberManager(
std::unique_ptr<LoopController> loopController, std::unique_ptr<LoopController> loopController,
Options options) Options options)
: FiberManager( : FiberManager(LocalType<void>(), std::move(loopController), options) {}
LocalType<void>(),
std::move(loopController),
std::move(options)) {}
FiberManager::~FiberManager() { FiberManager::~FiberManager() {
loopController_.reset(); loopController_.reset();
......
...@@ -1059,7 +1059,7 @@ void AsyncServerSocket::dispatchError(const char* msgstr, int errnoValue) { ...@@ -1059,7 +1059,7 @@ void AsyncServerSocket::dispatchError(const char* msgstr, int errnoValue) {
QueueMessage msg; QueueMessage msg;
msg.type = MessageType::MSG_ERROR; msg.type = MessageType::MSG_ERROR;
msg.err = errnoValue; msg.err = errnoValue;
msg.msg = std::move(msgstr); msg.msg = msgstr;
while (true) { while (true) {
// Short circuit if the callback is in the primary EventBase thread // Short circuit if the callback is in the primary EventBase thread
......
...@@ -74,7 +74,7 @@ MemoryMapping::MemoryMapping( ...@@ -74,7 +74,7 @@ MemoryMapping::MemoryMapping(
off_t offset, off_t offset,
off_t length, off_t length,
Options options) Options options)
: file_(std::move(file)), options_(std::move(options)) { : file_(std::move(file)), options_(options) {
CHECK(file_); CHECK(file_);
init(offset, length); init(offset, length);
} }
...@@ -98,7 +98,7 @@ MemoryMapping::MemoryMapping( ...@@ -98,7 +98,7 @@ MemoryMapping::MemoryMapping(
: MemoryMapping(File(fd), offset, length, options) {} : MemoryMapping(File(fd), offset, length, options) {}
MemoryMapping::MemoryMapping(AnonymousType, off_t length, Options options) MemoryMapping::MemoryMapping(AnonymousType, off_t length, Options options)
: options_(std::move(options)) { : options_(options) {
init(0, length); init(0, length);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment