Fix clang-tidy erros

This commit is contained in:
JCW
2026-05-05 11:52:12 +01:00
parent 0edd5174a1
commit 09851d906c
2 changed files with 14 additions and 13 deletions

View File

@@ -548,14 +548,14 @@ Logger::Logger(std::string_view const channel)
Logger::~Logger()
{
// One reference is held by logger_ and the other by spdlog registry
static constexpr size_t LAST_LOGGER_REF_COUNT = 2;
static constexpr size_t kLAST_LOGGER_REF_COUNT = 2;
if (logger_ == nullptr)
{
return; // LCOV_EXCL_LINE
}
if (logger_.use_count() == LAST_LOGGER_REF_COUNT)
if (logger_.use_count() == kLAST_LOGGER_REF_COUNT)
{
spdlog::drop(logger_->name());
}
@@ -578,6 +578,7 @@ Logger::Pump::Pump(
Logger::Pump::~Pump()
{
using namespace std::literals;
if (enabled_)
{
spdlog::source_loc const sourceLocation{
@@ -600,8 +601,8 @@ Logger::Pump::~Pump()
bool const hasMessage = !messageParams_.empty();
if (hasContext || hasMessage)
{
static constexpr char valuesOpen[] = ", \"values\": {";
wrapped.append(valuesOpen, valuesOpen + sizeof(valuesOpen) - 1);
static constexpr auto kVALUES_OPEN = ", \"values\": {"sv;
wrapped.append(kVALUES_OPEN);
wrapped.append(
contextParams_.data(), contextParams_.data() + contextParams_.size());
if (hasContext && hasMessage)
@@ -624,8 +625,8 @@ Logger::Pump::~Pump()
fmt::memory_buffer buf;
buf.push_back('[');
buf.append(contextParams_.data(), contextParams_.data() + contextParams_.size());
static constexpr char close[] = "] ";
buf.append(close, close + 2);
static constexpr auto kCLOSE = "] "sv;
buf.append(kCLOSE);
buf.append(stream_.data(), stream_.data() + stream_.size());
logger_->log(
sourceLocation,

View File

@@ -431,13 +431,13 @@ TEST(AccountSet, TransferRate)
// Test data: {rate to set, expected TER, expected stored rate}
std::vector<TestCase> const testData = {
{1.0, tesSUCCESS, 1.0},
{1.1, tesSUCCESS, 1.1},
{2.0, tesSUCCESS, 2.0},
{2.1, temBAD_TRANSFER_RATE, 2.0}, // > 2.0 is invalid
{0.0, tesSUCCESS, 1.0}, // 0 clears the rate (default = 1.0)
{2.0, tesSUCCESS, 2.0},
{0.9, temBAD_TRANSFER_RATE, 2.0}, // < 1.0 is invalid
{.set = 1.0, .code = tesSUCCESS, .get = 1.0},
{.set = 1.1, .code = tesSUCCESS, .get = 1.1},
{.set = 2.0, .code = tesSUCCESS, .get = 2.0},
{.set = 2.1, .code = temBAD_TRANSFER_RATE, .get = 2.0}, // > 2.0 is invalid
{.set = 0.0, .code = tesSUCCESS, .get = 1.0}, // 0 clears the rate (default = 1.0)
{.set = 2.0, .code = tesSUCCESS, .get = 2.0},
{.set = 0.9, .code = temBAD_TRANSFER_RATE, .get = 2.0}, // < 1.0 is invalid
};
TxTest env;