Fix clang-tidy: use make_unique and fix include order

- Replace std::unique_ptr{new ...} with make_unique
- Fix include order to satisfy clang-format
This commit is contained in:
J. Nick Koston
2026-03-01 00:23:05 -10:00
parent 529c79a8a9
commit 5d9c3a0e71
2 changed files with 4 additions and 4 deletions
@@ -1,6 +1,6 @@
#include "socket.h"
#include "esphome/core/defines.h"
#include "esphome/core/helpers.h"
#include "socket.h"
#ifdef USE_SOCKET_IMPL_BSD_SOCKETS
@@ -75,7 +75,7 @@ static std::unique_ptr<BSDSocketImpl> create_socket(int domain, int type, int pr
int ret = ::socket(domain, type, protocol);
if (ret == -1)
return nullptr;
return std::unique_ptr<BSDSocketImpl>{new BSDSocketImpl(ret, loop_monitored)};
return make_unique<BSDSocketImpl>(ret, loop_monitored);
}
std::unique_ptr<Socket> socket(int domain, int type, int protocol) {
@@ -1,6 +1,6 @@
#include "socket.h"
#include "esphome/core/defines.h"
#include "esphome/core/helpers.h"
#include "socket.h"
#ifdef USE_SOCKET_IMPL_LWIP_SOCKETS
@@ -75,7 +75,7 @@ static std::unique_ptr<LwIPSocketImpl> create_socket(int domain, int type, int p
int ret = lwip_socket(domain, type, protocol);
if (ret == -1)
return nullptr;
return std::unique_ptr<LwIPSocketImpl>{new LwIPSocketImpl(ret, loop_monitored)};
return make_unique<LwIPSocketImpl>(ret, loop_monitored);
}
std::unique_ptr<Socket> socket(int domain, int type, int protocol) {