From fc7e7baed757b0c4f48669b94d5a99bece85d979 Mon Sep 17 00:00:00 2001 From: Tony Lewis Date: Tue, 21 Jul 2020 15:39:06 +0100 Subject: [PATCH] Apply clang-format to the changed code --- include/fmt/format.h | 9 ++++----- test/ranges-test.cc | 42 ++++++++++++++++++++---------------------- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 3d0abd41..712c6ebe 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3420,15 +3420,14 @@ arg_join join(It begin, Sentinel end, wstring_view sep) { \endrst */ template -arg_join, detail::sentinel_t, char> -join(Range&& range, string_view sep) { +arg_join, detail::sentinel_t, char> join( + Range&& range, string_view sep) { return join(std::begin(range), std::end(range), sep); } template -arg_join, detail::sentinel_t, - wchar_t> -join(Range&& range, wstring_view sep) { +arg_join, detail::sentinel_t, wchar_t> join( + Range&& range, wstring_view sep) { return join(std::begin(range), std::end(range), sep); } diff --git a/test/ranges-test.cc b/test/ranges-test.cc index 7f1c845b..518e7ba2 100644 --- a/test/ranges-test.cc +++ b/test/ranges-test.cc @@ -154,38 +154,36 @@ TEST(RangesTest, JoinSentinel) { EXPECT_EQ("h_e_l_l_o", fmt::format("{}", fmt::join(hello, "_"))); } -// A range that provides non-const only begin()/end() to test fmt::join handles that +// A range that provides non-const only begin()/end() to test fmt::join handles +// that // -// Some ranges (eg those produced by range-v3's views::filter()) can cache information -// during iteration so they only provide non-const begin()/end(). -template -class non_const_only_range { - private: - std::vector vec; +// Some ranges (eg those produced by range-v3's views::filter()) can cache +// information during iteration so they only provide non-const begin()/end(). +template class non_const_only_range { + private: + std::vector vec; - public: - using const_iterator = typename ::std::vector::const_iterator; + public: + using const_iterator = typename ::std::vector::const_iterator; - template - explicit non_const_only_range(Args &&...args) : vec( ::std::forward( args )... ) {} + template + explicit non_const_only_range(Args&&... args) + : vec(::std::forward(args)...) {} - const_iterator begin() { - return vec.begin(); - } - const_iterator end() { - return vec.end(); - } + const_iterator begin() { return vec.begin(); } + const_iterator end() { return vec.end(); } }; TEST(RangesTest, JoinRange) { - non_const_only_range x( 3, 0 ); + non_const_only_range x(3, 0); EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(x, ","))); - EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(non_const_only_range( 3, 0 ), ","))); + EXPECT_EQ("0,0,0", + fmt::format("{}", fmt::join(non_const_only_range(3, 0), ","))); - std::vector y( 3, 0 ); + std::vector y(3, 0); EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(y, ","))); - EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(std::vector( 3, 0 ), ","))); + EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(std::vector(3, 0), ","))); - const std::vector z( 3, 0 ); + const std::vector z(3, 0); EXPECT_EQ("0,0,0", fmt::format("{}", fmt::join(z, ","))); }