From 4aa6bf94e48f7fea2212b9b3a4f55784173dd17b Mon Sep 17 00:00:00 2001 From: Yedidya Feldblum Date: Wed, 7 Jun 2017 14:39:54 -0700 Subject: [PATCH] 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 --- folly/futures/Future-inl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/folly/futures/Future-inl.h b/folly/futures/Future-inl.h index 79b73a07..2a8b56b8 100644 --- a/folly/futures/Future-inl.h +++ b/folly/futures/Future-inl.h @@ -416,7 +416,7 @@ Future::onError(F&& func) { if (tf2.hasException()) { state.setException(std::move(tf2.exception())); } else { - tf2->setCallback_([p = state.stealPromise()](Try t3) mutable { + tf2->setCallback_([p = state.stealPromise()](Try && t3) mutable { p.setTry(std::move(t3)); }); } @@ -444,7 +444,7 @@ Future::onError(F&& func) { auto f = p.getFuture(); setCallback_( [state = detail::makeCoreCallbackState( - std::move(p), std::forward(func))](Try t) mutable { + std::move(p), std::forward(func))](Try && t) mutable { if (t.hasException()) { state.setTry(makeTryWith( [&] { return state.invoke(std::move(t.exception())); })); -- 2.34.1