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

Apply clang-format to folly/fibers/

Summary: [Folly] Apply `clang-format` to `folly/fibers/`.

Reviewed By: igorsugak

Differential Revision: D9625725

fbshipit-source-id: e00f6406db994a1a3f17c1d23b415bea13495e99
parent fa256453
...@@ -94,7 +94,7 @@ void TaskIterator<T>::addTask(F&& func) { ...@@ -94,7 +94,7 @@ void TaskIterator<T>::addTask(F&& func) {
auto taskId = context_->totalTasks++; auto taskId = context_->totalTasks++;
fm_.addTask( fm_.addTask(
[ taskId, context = context_, func = std::forward<F>(func) ]() mutable { [taskId, context = context_, func = std::forward<F>(func)]() mutable {
context->results.emplace_back( context->results.emplace_back(
taskId, folly::makeTryWith(std::move(func))); taskId, folly::makeTryWith(std::move(func)));
......
...@@ -31,7 +31,7 @@ auto FiberManager::addTaskFuture(F&& func) ...@@ -31,7 +31,7 @@ auto FiberManager::addTaskFuture(F&& func)
auto f = p.getFuture(); auto f = p.getFuture();
addTaskFinally( addTaskFinally(
[func = std::forward<F>(func)]() mutable { return func(); }, [func = std::forward<F>(func)]() mutable { return func(); },
[p = std::move(p)](folly::Try<T> && t) mutable { [p = std::move(p)](folly::Try<T>&& t) mutable {
p.setTry(std::move(t)); p.setTry(std::move(t));
}); });
return f; return f;
...@@ -43,7 +43,7 @@ auto FiberManager::addTaskRemoteFuture(F&& func) ...@@ -43,7 +43,7 @@ auto FiberManager::addTaskRemoteFuture(F&& func)
folly::Promise<typename folly::lift_unit<invoke_result_t<F>>::type> p; folly::Promise<typename folly::lift_unit<invoke_result_t<F>>::type> p;
auto f = p.getFuture(); auto f = p.getFuture();
addTaskRemote( addTaskRemote(
[ p = std::move(p), func = std::forward<F>(func), this ]() mutable { [p = std::move(p), func = std::forward<F>(func), this]() mutable {
auto t = folly::makeTryWith(std::forward<F>(func)); auto t = folly::makeTryWith(std::forward<F>(func));
runInMainContext([&]() { p.setTry(std::move(t)); }); runInMainContext([&]() { p.setTry(std::move(t)); });
}); });
......
...@@ -50,14 +50,12 @@ inline void forEach(InputIterator first, InputIterator last, F&& f) { ...@@ -50,14 +50,12 @@ inline void forEach(InputIterator first, InputIterator last, F&& f) {
Baton baton; Baton baton;
auto taskFunc = [&tasksTodo, &e, &f, &baton](size_t id, FuncType&& func) { auto taskFunc = [&tasksTodo, &e, &f, &baton](size_t id, FuncType&& func) {
return [ return [id,
id, &tasksTodo,
&tasksTodo, &e,
&e, &f,
&f, &baton,
&baton, func_ = std::forward<FuncType>(func)]() mutable {
func_ = std::forward<FuncType>(func)
]() mutable {
try { try {
callFuncs(std::forward<FuncType>(func_), f, id); callFuncs(std::forward<FuncType>(func_), f, id);
} catch (...) { } catch (...) {
......
...@@ -54,7 +54,7 @@ collectN(InputIterator first, InputIterator last, size_t n) { ...@@ -54,7 +54,7 @@ collectN(InputIterator first, InputIterator last, size_t n) {
await([first, last, context](Promise<void> promise) mutable { await([first, last, context](Promise<void> promise) mutable {
context->promise = std::move(promise); context->promise = std::move(promise);
for (size_t i = 0; first != last; ++i, ++first) { for (size_t i = 0; first != last; ++i, ++first) {
addTask([ i, context, f = std::move(*first) ]() { addTask([i, context, f = std::move(*first)]() {
try { try {
auto result = f(); auto result = f();
if (context->tasksTodo == 0) { if (context->tasksTodo == 0) {
...@@ -108,7 +108,7 @@ collectN(InputIterator first, InputIterator last, size_t n) { ...@@ -108,7 +108,7 @@ collectN(InputIterator first, InputIterator last, size_t n) {
await([first, last, context](Promise<void> promise) mutable { await([first, last, context](Promise<void> promise) mutable {
context->promise = std::move(promise); context->promise = std::move(promise);
for (size_t i = 0; first != last; ++i, ++first) { for (size_t i = 0; first != last; ++i, ++first) {
addTask([ i, context, f = std::move(*first) ]() { addTask([i, context, f = std::move(*first)]() {
try { try {
f(); f();
if (context->tasksTodo == 0) { if (context->tasksTodo == 0) {
......
...@@ -341,9 +341,8 @@ TEST(FiberManager, awaitThrow) { ...@@ -341,9 +341,8 @@ TEST(FiberManager, awaitThrow) {
EXPECT_THROW( EXPECT_THROW(
await([&](Promise<int> p) { await([&](Promise<int> p) {
evb.runInEventBaseThread([p = std::move(p)]() mutable { evb.runInEventBaseThread(
p.setValue(42); [p = std::move(p)]() mutable { p.setValue(42); });
});
throw ExpectedException(); throw ExpectedException();
}), }),
ExpectedException); ExpectedException);
......
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