style: clang-tidy auto fixes (#2112)

Fixes #2111. Please review and commit clang-tidy fixes.

Co-authored-by: godexsoft <385326+godexsoft@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2025-05-14 11:28:40 +01:00
committed by GitHub
parent 2d52966806
commit a369381594
6 changed files with 9 additions and 10 deletions

View File

@@ -29,7 +29,7 @@ namespace {
std::unordered_set<std::string_view> const& std::unordered_set<std::string_view> const&
handledRpcs() handledRpcs()
{ {
static std::unordered_set<std::string_view> kHANDLED_RPCS = { static std::unordered_set<std::string_view> const kHANDLED_RPCS = {
"account_channels", "account_channels",
"account_currencies", "account_currencies",
"account_info", "account_info",

View File

@@ -66,7 +66,7 @@ Weights::requestWeight(boost::json::object const& request) const
return defaultWeight_; return defaultWeight_;
} }
std::string_view cmd = std::string_view const cmd =
request.contains(JS(method)) ? request.at(JS(method)).as_string() : request.at(JS(command)).as_string(); request.contains(JS(method)) ? request.at(JS(method)).as_string() : request.at(JS(command)).as_string();
auto it = weights_.find(cmd); auto it = weights_.find(cmd);

View File

@@ -309,7 +309,7 @@ private:
e["id"] = request.as_object().at("id"); e["id"] = request.as_object().at("id");
e["request"] = std::move(request); e["request"] = std::move(request);
} catch (std::exception const&) { } catch (std::exception const&) {
e["request"] = std::move(requestStr); e["request"] = requestStr;
} }
this->send(std::make_shared<std::string>(boost::json::serialize(e))); this->send(std::make_shared<std::string>(boost::json::serialize(e)));

View File

@@ -45,7 +45,6 @@
#include <memory> #include <memory>
#include <optional> #include <optional>
#include <string> #include <string>
#include <string_view>
#include <utility> #include <utility>
namespace web::ng::impl { namespace web::ng::impl {

View File

@@ -30,7 +30,7 @@ using namespace util;
TEST(StringHashTest, HashesConsistently) TEST(StringHashTest, HashesConsistently)
{ {
StringHash hasher; StringHash const hasher;
std::string const stdString = "test string"; std::string const stdString = "test string";
std::string_view const strView = "test string"; std::string_view const strView = "test string";
@@ -43,7 +43,7 @@ TEST(StringHashTest, HashesConsistently)
TEST(StringHashTest, TransparentLookup) TEST(StringHashTest, TransparentLookup)
{ {
std::unordered_set<std::string, StringHash, std::equal_to<>> stringSet{"hello world"}; std::unordered_set<std::string, StringHash, std::equal_to<>> const stringSet{"hello world"};
std::string const stdString = "hello world"; std::string const stdString = "hello world";
std::string_view const strView = "hello world"; std::string_view const strView = "hello world";
@@ -58,7 +58,7 @@ TEST(StringHashTest, TransparentLookup)
TEST(StringHashTest, EmptyStrings) TEST(StringHashTest, EmptyStrings)
{ {
StringHash hasher; StringHash const hasher;
std::string const emptyStdString; std::string const emptyStdString;
std::string_view const emptyStrView; std::string_view const emptyStrView;

View File

@@ -28,7 +28,7 @@ struct RpcNameConstraintTest : testing::Test {};
TEST_F(RpcNameConstraintTest, WrongType) TEST_F(RpcNameConstraintTest, WrongType)
{ {
Value value{1}; Value const value{1};
auto const maybeError = gRpcNameConstraint.checkConstraint(value); auto const maybeError = gRpcNameConstraint.checkConstraint(value);
ASSERT_TRUE(maybeError.has_value()); ASSERT_TRUE(maybeError.has_value());
EXPECT_EQ(maybeError->error, "RPC command name must be a string"); EXPECT_EQ(maybeError->error, "RPC command name must be a string");
@@ -36,7 +36,7 @@ TEST_F(RpcNameConstraintTest, WrongType)
TEST_F(RpcNameConstraintTest, WrongValue) TEST_F(RpcNameConstraintTest, WrongValue)
{ {
Value value{"non_existing_rpc"}; Value const value{"non_existing_rpc"};
auto const maybeError = gRpcNameConstraint.checkConstraint(value); auto const maybeError = gRpcNameConstraint.checkConstraint(value);
ASSERT_TRUE(maybeError.has_value()); ASSERT_TRUE(maybeError.has_value());
EXPECT_EQ(maybeError->error, "Invalid RPC command name"); EXPECT_EQ(maybeError->error, "Invalid RPC command name");
@@ -44,7 +44,7 @@ TEST_F(RpcNameConstraintTest, WrongValue)
TEST_F(RpcNameConstraintTest, CorrectValue) TEST_F(RpcNameConstraintTest, CorrectValue)
{ {
Value value{"server_info"}; Value const value{"server_info"};
auto const maybeError = gRpcNameConstraint.checkConstraint(value); auto const maybeError = gRpcNameConstraint.checkConstraint(value);
ASSERT_FALSE(maybeError.has_value()); ASSERT_FALSE(maybeError.has_value());
} }