Commit 55f34d09 authored by Hans Fugal's avatar Hans Fugal Committed by facebook-github-bot-1

(folly) have Try::moveFromTry take an lvalue

Summary: This is a case of having to say what you're doing twice, and it's unnecessary.
This change should not break anything as calling `std::move(lvalue)` where an
lvalue reference is expected will just be superfluous.

Reviewed By: @jsedgwick

Differential Revision: D2534944

fb-gh-sync-id: fdcd168f369d95b0f28abe23b401b4321f51fc36
parent 1dee433c
...@@ -519,7 +519,7 @@ inline await(F&& func) { ...@@ -519,7 +519,7 @@ inline await(F&& func) {
func(Promise<Result>(result, baton)); func(Promise<Result>(result, baton));
}); });
return folly::moveFromTry(std::move(result)); return folly::moveFromTry(result);
} }
}} }}
...@@ -131,11 +131,11 @@ void Try<void>::throwIfFailed() const { ...@@ -131,11 +131,11 @@ void Try<void>::throwIfFailed() const {
} }
template <typename T> template <typename T>
inline T moveFromTry(Try<T>&& t) { inline T moveFromTry(Try<T>& t) {
return std::move(t.value()); return std::move(t.value());
} }
inline void moveFromTry(Try<void>&& t) { inline void moveFromTry(Try<void>& t) {
return t.value(); return t.value();
} }
......
...@@ -350,14 +350,14 @@ class Try<void> { ...@@ -350,14 +350,14 @@ class Try<void> {
* @returns value contained in t * @returns value contained in t
*/ */
template <typename T> template <typename T>
T moveFromTry(Try<T>&& t); T moveFromTry(Try<T>& t);
/* /*
* Throws if try contained an exception. * Throws if try contained an exception.
* *
* @param t Try to move from * @param t Try to move from
*/ */
void moveFromTry(Try<void>&& t); void moveFromTry(Try<void>& t);
/* /*
* @param f a function to execute and capture the result of (value or exception) * @param f a function to execute and capture the result of (value or exception)
......
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