clang-tidy: modernize-pass-by-value

This commit is contained in:
Peter Johnson
2020-12-28 10:12:52 -08:00
parent 29c7da5f1a
commit aee4603269
32 changed files with 158 additions and 107 deletions

View File

@@ -6,6 +6,7 @@
#define WPIUTIL_WPI_LOGGER_H_
#include <functional>
#include <utility>
#include "wpi/SmallString.h"
#include "wpi/raw_ostream.h"
@@ -30,9 +31,9 @@ class Logger {
unsigned int line, const char* msg)>;
Logger() = default;
explicit Logger(const LogFunc& func) : m_func(func) {}
Logger(const LogFunc& func, unsigned int min_level)
: m_func(func), m_min_level(min_level) {}
explicit Logger(LogFunc func) : m_func(std::move(func)) {}
Logger(LogFunc func, unsigned int min_level)
: m_func(std::move(func)), m_min_level(min_level) {}
void SetLogger(LogFunc func) { m_func = func; }

View File

@@ -122,7 +122,7 @@ class WebSocketServer : public std::enable_shared_from_this<WebSocketServer> {
* Private constructor.
*/
WebSocketServer(uv::Stream& stream, ArrayRef<StringRef> protocols,
const ServerOptions& options, const private_init&);
ServerOptions options, const private_init&);
/**
* Starts a dedicated WebSocket server on the provided connection. The

View File

@@ -5,6 +5,8 @@
#ifndef WPIUTIL_WPI_RAW_UV_OSTREAM_H_
#define WPIUTIL_WPI_RAW_UV_OSTREAM_H_
#include <utility>
#include "wpi/ArrayRef.h"
#include "wpi/SmallVector.h"
#include "wpi/raw_ostream.h"
@@ -38,7 +40,7 @@ class raw_uv_ostream : public raw_ostream {
*/
raw_uv_ostream(SmallVectorImpl<uv::Buffer>& bufs,
std::function<uv::Buffer()> alloc)
: m_bufs(bufs), m_alloc(alloc) {
: m_bufs(bufs), m_alloc(std::move(alloc)) {
SetUnbuffered();
}