Commit 986a6124 authored by Marc Berenbach's avatar Marc Berenbach Committed by Facebook Github Bot

Fix unnecessary copy warnings found by Infer

Summary:
Infer AL has reported valid warnings on some folly and thrift code:

```
fbcode/folly/io/async/AsyncUDPServerSocket.h:228:19:
WARNING Extra Copy: Potentially unnecessary to copy var `client` at line 228, column 19. Use 'const auto&' or 'auto&' if possible.
fbcode/folly/io/async/AsyncUDPServerSocket.h:230:19:
WARNING Extra Copy: Potentially unnecessary to copy var `socket` at line 230, column 19. Use 'const auto&' or 'auto&' if possible.
fbcode/thrift/lib/cpp/TProcessorEventHandler.h:148:15:
WARNING Extra Copy: Potentially unnecessary to copy var `ew` at line 148, column 15. Use 'const auto&' or 'auto&' if possible.
fbcode/thrift/lib/cpp2/server/ThriftServer.h:705:20:
WARNING Extra Copy: Potentially unnecessary to copy var `sockets` at line 705, column 20. Use 'const auto&' or 'auto&' if possible.
```

As these are transitively included in many services, they are fairly prevalent/annoying warnings. Let's fix them.

Reviewed By: yfeldblum

Differential Revision: D14168260

fbshipit-source-id: 12e537fe5aa73e653c15c4fef01ac618e51cd4d0
parent 223aae6b
......@@ -225,14 +225,12 @@ class AsyncUDPServerSocket : private AsyncUDPSocket::ReadCallback,
break;
}
auto client = clientAddress;
auto callback = listeners_[listenerId].second;
auto socket = socket_;
// Schedule it in the listener's eventbase
// XXX: Speed this up
auto f = [socket,
client,
auto f = [socket = socket_,
client = clientAddress,
callback,
data = std::move(data),
truncated]() mutable {
......
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