Skip to content

Commit

Permalink
modernize Future::get(): 4/n = codemod to std::move for non-ptr exprs
Browse files Browse the repository at this point in the history
Summary:
Codemod non-pointer expressions:
   - expr.get() ==> std::move(expr).get()
   - expr.get(dur) ==> std::move(expr).get(dur)
when expr is not already an xvalue.

Reviewed By: yfeldblum

Differential Revision: D8430137

fbshipit-source-id: 20da463f9cceb5cb1e71a7226f3b11d1e8007011
  • Loading branch information
Marshall Cline authored and facebook-github-bot committed Jun 15, 2018
1 parent de0344e commit edd050b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions folly/fibers/test/FibersTest.cpp
Expand Up @@ -1494,8 +1494,8 @@ TEST(FiberManager, remoteFutureTest) {
auto f1 = fiberManager.addTaskFuture([&]() { return testValue1; });
auto f2 = fiberManager.addTaskRemoteFuture([&]() { return testValue2; });
loopController.loop([&]() { loopController.stop(); });
auto v1 = f1.get();
auto v2 = f2.get();
auto v1 = std::move(f1).get();
auto v2 = std::move(f2).get();

EXPECT_EQ(v1, testValue1);
EXPECT_EQ(v2, testValue2);
Expand Down
2 changes: 1 addition & 1 deletion folly/futures/test/Benchmark.cpp
Expand Up @@ -319,7 +319,7 @@ BENCHMARK(lvalue_get) {
Optional<Future<Bulky>> future;
future = makeFuture(Bulky("Hello"));
suspender.dismissing([&] {
std::string message = future.value().get().message();
std::string message = std::move(future.value()).get().message();
doNotOptimizeAway(message);
});
}
Expand Down
2 changes: 1 addition & 1 deletion folly/logging/test/AsyncFileWriterTest.cpp
Expand Up @@ -256,7 +256,7 @@ TEST(AsyncFileWriter, flush) {
readFull(readPipe.fd(), buf.data(), buf.size());

// Make sure flush completes successfully now
future.get(10ms);
std::move(future).get(10ms);
}

// A large-ish message suffix, just to consume space and help fill up
Expand Down

0 comments on commit edd050b

Please sign in to comment.