From d5e3e3473ed1a70fc57a0c5e903da51e3d432b81 Mon Sep 17 00:00:00 2001 From: Walter Gray Date: Sat, 14 Nov 2020 13:25:40 -0800 Subject: [PATCH] clang-format --- include/fmt/chrono.h | 15 ++++++++++----- test/format-test.cc | 19 +++++++++---------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index 522cf495..24347bf9 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -772,8 +772,10 @@ OutputIt format_duration_value(OutputIt out, Rep val, int) { template ::value)> OutputIt format_duration_value(OutputIt out, Rep val, int precision) { - static FMT_CONSTEXPR_DECL const Char pr_f[] = {'{', ':', '.', '{', '}', 'f', '}', 0}; - if (precision >= 0) return format_to(out, compile_string_to_view(pr_f), val, precision); + static FMT_CONSTEXPR_DECL const Char pr_f[] = {'{', ':', '.', '{', + '}', 'f', '}', 0}; + if (precision >= 0) + return format_to(out, compile_string_to_view(pr_f), val, precision); static FMT_CONSTEXPR_DECL const Char fp_f[] = {'{', ':', 'g', '}', 0}; return format_to(out, compile_string_to_view(fp_f), val); } @@ -796,9 +798,12 @@ OutputIt format_duration_unit(OutputIt out) { if (const char* unit = get_units()) return copy_unit(string_view(unit), out, Char()); static FMT_CONSTEXPR_DECL const Char num_f[] = {'[', '{', '}', ']', 's', 0}; - if (const_check(Period::den == 1)) return format_to(out, compile_string_to_view(num_f), Period::num); - static FMT_CONSTEXPR_DECL const Char num_def_f[] = {'[', '{', '}', '/', '{', '}', ']', 's', 0}; - return format_to(out, compile_string_to_view(num_def_f), Period::num, Period::den); + if (const_check(Period::den == 1)) + return format_to(out, compile_string_to_view(num_f), Period::num); + static FMT_CONSTEXPR_DECL const Char num_def_f[] = {'[', '{', '}', '/', '{', + '}', ']', 's', 0}; + return format_to(out, compile_string_to_view(num_def_f), Period::num, + Period::den); } template -class allocator_max_size: public Allocator { +class allocator_max_size : public Allocator { public: using typename Allocator::value_type; - size_t max_size() const FMT_NOEXCEPT { - return MaxSize; - } + size_t max_size() const FMT_NOEXCEPT { return MaxSize; } value_type* allocate(size_t n) { if (n > max_size()) { throw std::length_error("size > max_size"); } return std::allocator_traits::allocate( - *static_cast(this), n); + *static_cast(this), n); } void deallocate(value_type* p, size_t n) { - std::allocator_traits::deallocate( - *static_cast(this), p, n); + std::allocator_traits::deallocate(*static_cast(this), + p, n); } }; @@ -383,7 +381,7 @@ TEST(MemoryBufferTest, AllocatorMaxSize) { try { // new_capacity = 128 + 128/2 = 192 > 160 buffer.resize(160); - } catch (const std::exception &) { + } catch (const std::exception&) { throws_on_resize = true; } EXPECT_FALSE(throws_on_resize); @@ -395,7 +393,7 @@ TEST(MemoryBufferTest, AllocatorMaxSizeOverflow) { bool throws_on_resize = false; try { buffer.resize(161); - } catch (const std::exception &) { + } catch (const std::exception&) { throws_on_resize = true; } EXPECT_TRUE(throws_on_resize); @@ -1808,7 +1806,8 @@ fmt::string_view to_string_view(string_like) { return "foo"; } constexpr char with_null[3] = {'{', '}', '\0'}; constexpr char no_null[2] = {'{', '}'}; static FMT_CONSTEXPR_DECL const char static_with_null[3] = {'{', '}', '\0'}; -static FMT_CONSTEXPR_DECL const wchar_t static_with_null_wide[3] = {'{', '}', '\0'}; +static FMT_CONSTEXPR_DECL const wchar_t static_with_null_wide[3] = {'{', '}', + '\0'}; static FMT_CONSTEXPR_DECL const char static_no_null[2] = {'{', '}'}; static FMT_CONSTEXPR_DECL const wchar_t static_no_null_wide[2] = {'{', '}'};