Skip to content

Commit 01ef094

Browse files
committed
clang-tidy: Fix performance-unnecessary-value-param check
See: https://clang.llvm.org/extra/clang-tidy/checks/performance/unnecessary-value-param.html
1 parent c665a43 commit 01ef094

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/mp/proxy-io.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ struct ProxyClient<Thread> : public ProxyClientBase<Thread, ::capnp::Void>
6363
ProxyClient(const ProxyClient&) = delete;
6464
~ProxyClient();
6565

66-
void setCleanup(std::function<void()> fn);
66+
void setCleanup(const std::function<void()>& fn);
6767

6868
//! Cleanup function to run when the connection is closed. If the Connection
6969
//! gets destroyed before this ProxyClient<Thread> object, this cleanup
@@ -523,7 +523,7 @@ using ConnThread = ConnThreads::iterator;
523523
// Retrieve ProxyClient<Thread> object associated with this connection from a
524524
// map, or create a new one and insert it into the map. Return map iterator and
525525
// inserted bool.
526-
std::tuple<ConnThread, bool> SetThread(ConnThreads& threads, std::mutex& mutex, Connection* connection, std::function<Thread::Client()> make_thread);
526+
std::tuple<ConnThread, bool> SetThread(ConnThreads& threads, std::mutex& mutex, Connection* connection, const std::function<Thread::Client()>& make_thread);
527527

528528
struct ThreadContext
529529
{

src/mp/proxy.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ bool EventLoop::done(std::unique_lock<std::mutex>& lock)
281281
return m_num_clients == 0 && m_async_fns.empty();
282282
}
283283

284-
std::tuple<ConnThread, bool> SetThread(ConnThreads& threads, std::mutex& mutex, Connection* connection, std::function<Thread::Client()> make_thread)
284+
std::tuple<ConnThread, bool> SetThread(ConnThreads& threads, std::mutex& mutex, Connection* connection, const std::function<Thread::Client()>& make_thread)
285285
{
286286
const std::unique_lock<std::mutex> lock(mutex);
287287
auto thread = threads.find(connection);
@@ -316,7 +316,7 @@ ProxyClient<Thread>::~ProxyClient()
316316
}
317317
}
318318

319-
void ProxyClient<Thread>::setCleanup(std::function<void()> fn)
319+
void ProxyClient<Thread>::setCleanup(const std::function<void()>& fn)
320320
{
321321
assert(fn);
322322
assert(!m_cleanup_it);

0 commit comments

Comments
 (0)