Commit 4aa6bf94 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Pass Try by rvalue ref in onError implementation

Summary:
[Folly] Pass `Try` by rvalue ref in `onError` implementation.

As is done in other overloads and in `thenImplementation`. For consistency.

Reviewed By: spacedentist

Differential Revision: D5199302

fbshipit-source-id: c78db0c36fc7a0b846ca5e44fc237422c9203a24
parent 3d6d4933
......@@ -416,7 +416,7 @@ Future<T>::onError(F&& func) {
if (tf2.hasException()) {
state.setException(std::move(tf2.exception()));
} else {
tf2->setCallback_([p = state.stealPromise()](Try<T> t3) mutable {
tf2->setCallback_([p = state.stealPromise()](Try<T> && t3) mutable {
p.setTry(std::move(t3));
});
}
......@@ -444,7 +444,7 @@ Future<T>::onError(F&& func) {
auto f = p.getFuture();
setCallback_(
[state = detail::makeCoreCallbackState(
std::move(p), std::forward<F>(func))](Try<T> t) mutable {
std::move(p), std::forward<F>(func))](Try<T> && t) mutable {
if (t.hasException()) {
state.setTry(makeTryWith(
[&] { return state.invoke(std::move(t.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