mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 18:57:34 +02:00
Update and apply clang-format
This commit is contained in:
@ -7,6 +7,7 @@ IndentCaseLabels: false
|
|||||||
AlwaysBreakTemplateDeclarations: false
|
AlwaysBreakTemplateDeclarations: false
|
||||||
DerivePointerAlignment: false
|
DerivePointerAlignment: false
|
||||||
AllowShortCaseLabelsOnASingleLine: true
|
AllowShortCaseLabelsOnASingleLine: true
|
||||||
|
QualifierAlignment: Left
|
||||||
AlignConsecutiveShortCaseStatements:
|
AlignConsecutiveShortCaseStatements:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
AcrossEmptyLines: true
|
AcrossEmptyLines: true
|
||||||
|
@ -1097,7 +1097,7 @@ template <> struct cache_accessor<double> {
|
|||||||
return {r.high(), r.low() == 0};
|
return {r.high(), r.low() == 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto compute_delta(cache_entry_type const& cache, int beta) noexcept
|
static auto compute_delta(const cache_entry_type& cache, int beta) noexcept
|
||||||
-> uint32_t {
|
-> uint32_t {
|
||||||
return static_cast<uint32_t>(cache.high() >> (64 - 1 - beta));
|
return static_cast<uint32_t>(cache.high() >> (64 - 1 - beta));
|
||||||
}
|
}
|
||||||
|
@ -95,18 +95,17 @@ TEST(string_view_test, compare) {
|
|||||||
#if FMT_USE_CONSTEVAL
|
#if FMT_USE_CONSTEVAL
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N> struct fixed_string {
|
||||||
struct fixed_string {
|
|
||||||
char data[N] = {};
|
char data[N] = {};
|
||||||
|
|
||||||
constexpr fixed_string(char const (&m)[N]) {
|
constexpr fixed_string(const char (&m)[N]) {
|
||||||
for (size_t i = 0; i != N; ++i) {
|
for (size_t i = 0; i != N; ++i) {
|
||||||
data[i] = m[i];
|
data[i] = m[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace
|
||||||
|
|
||||||
TEST(string_view_test, from_constexpr_fixed_string) {
|
TEST(string_view_test, from_constexpr_fixed_string) {
|
||||||
static constexpr auto fs = fixed_string<5>("x={}");
|
static constexpr auto fs = fixed_string<5>("x={}");
|
||||||
|
@ -583,7 +583,8 @@ TEST(format_test, named_arg) {
|
|||||||
fmt::arg("A_", "A"), fmt::arg("_1", 1)));
|
fmt::arg("A_", "A"), fmt::arg("_1", 1)));
|
||||||
EXPECT_EQ(fmt::format("{0:{width}}", -42, fmt::arg("width", 4)), " -42");
|
EXPECT_EQ(fmt::format("{0:{width}}", -42, fmt::arg("width", 4)), " -42");
|
||||||
EXPECT_EQ(fmt::format("{value:{width}}", fmt::arg("value", -42),
|
EXPECT_EQ(fmt::format("{value:{width}}", fmt::arg("value", -42),
|
||||||
fmt::arg("width", 4)), " -42");
|
fmt::arg("width", 4)),
|
||||||
|
" -42");
|
||||||
EXPECT_EQ("st",
|
EXPECT_EQ("st",
|
||||||
fmt::format("{0:.{precision}}", "str", fmt::arg("precision", 2)));
|
fmt::format("{0:.{precision}}", "str", fmt::arg("precision", 2)));
|
||||||
EXPECT_EQ(fmt::format("{} {two}", 1, fmt::arg("two", 2)), "1 2");
|
EXPECT_EQ(fmt::format("{} {two}", 1, fmt::arg("two", 2)), "1 2");
|
||||||
@ -601,8 +602,9 @@ TEST(format_test, named_arg) {
|
|||||||
EXPECT_THROW_MSG((void)fmt::format(runtime("{a} {}"), fmt::arg("a", 2), 42),
|
EXPECT_THROW_MSG((void)fmt::format(runtime("{a} {}"), fmt::arg("a", 2), 42),
|
||||||
format_error,
|
format_error,
|
||||||
"cannot switch from manual to automatic argument indexing");
|
"cannot switch from manual to automatic argument indexing");
|
||||||
EXPECT_THROW_MSG((void)fmt::format("{a}", fmt::arg("a", 1),
|
EXPECT_THROW_MSG(
|
||||||
fmt::arg("a", 10)), format_error, "duplicate named arg");
|
(void)fmt::format("{a}", fmt::arg("a", 1), fmt::arg("a", 10)),
|
||||||
|
format_error, "duplicate named arg");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(format_test, auto_arg_index) {
|
TEST(format_test, auto_arg_index) {
|
||||||
|
@ -330,7 +330,7 @@ template <typename T> class noncopyable_range {
|
|||||||
explicit noncopyable_range(Args&&... args)
|
explicit noncopyable_range(Args&&... args)
|
||||||
: vec(std::forward<Args>(args)...) {}
|
: vec(std::forward<Args>(args)...) {}
|
||||||
|
|
||||||
noncopyable_range(noncopyable_range const&) = delete;
|
noncopyable_range(const noncopyable_range&) = delete;
|
||||||
noncopyable_range(noncopyable_range&) = delete;
|
noncopyable_range(noncopyable_range&) = delete;
|
||||||
|
|
||||||
auto begin() -> iterator { return vec.begin(); }
|
auto begin() -> iterator { return vec.begin(); }
|
||||||
|
Reference in New Issue
Block a user