Skip to content

Commit

Permalink
Apply clang-format
Browse files Browse the repository at this point in the history
* use clang-format v17.0.6 to reformat the tree
* tweak some places so that clang-format does not mutate the layout
  of code too much

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
  • Loading branch information
tchaikov authored and vitaut committed Dec 13, 2023
1 parent bbee753 commit 6855bd5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
7 changes: 4 additions & 3 deletions include/fmt/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,10 @@ OutputIt vformat_to(
fmt::emphasis::bold | fg(fmt::color::red), "{}", 42);
\endrst
*/
template <typename OutputIt, typename S, typename... Args,
bool enable = detail::is_output_iterator<OutputIt, char_t<S>>::value&&
detail::is_string<S>::value>
template <
typename OutputIt, typename S, typename... Args,
bool enable = detail::is_output_iterator<OutputIt, char_t<S>>::value &&
detail::is_string<S>::value>
inline auto format_to(OutputIt out, const text_style& ts, const S& format_str,
Args&&... args) ->
typename std::enable_if<enable, OutputIt>::type {
Expand Down
3 changes: 2 additions & 1 deletion include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -2429,7 +2429,8 @@ FMT_CONSTEXPR FMT_INLINE auto parse_format_specs(
case 'G':
return parse_presentation_type(pres::general_upper, float_set);
case 'c':
if (arg_type == type::bool_type) throw_format_error("invalid format specifier");
if (arg_type == type::bool_type)
throw_format_error("invalid format specifier");
return parse_presentation_type(pres::chr, integral_set);
case 's':
return parse_presentation_type(pres::string,
Expand Down
2 changes: 1 addition & 1 deletion include/fmt/ostream.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void format_value(buffer<Char>& buf, const T& value) {
auto&& format_buf = formatbuf<std::basic_streambuf<Char>>(buf);
auto&& output = std::basic_ostream<Char>(&format_buf);
#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR)
output.imbue(std::locale::classic()); // The default is always unlocalized.
output.imbue(std::locale::classic()); // The default is always unlocalized.
#endif
output << value;
output.exceptions(std::ios_base::failbit | std::ios_base::badbit);
Expand Down
10 changes: 4 additions & 6 deletions include/fmt/std.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ template <typename Char> struct formatter<std::filesystem::path, Char> {
debug_ = true;
++it;
}
if (it != end && (*it == 'g' || *it == 'n'))
path_type_ = *it++;
if (it != end && (*it == 'g' || *it == 'n')) path_type_ = *it++;
return it;
}

Expand Down Expand Up @@ -246,8 +245,7 @@ FMT_END_NAMESPACE
#ifdef __cpp_lib_source_location
FMT_BEGIN_NAMESPACE
FMT_EXPORT
template<>
struct formatter<std::source_location> {
template <> struct formatter<std::source_location> {
template <typename ParseContext> FMT_CONSTEXPR auto parse(ParseContext& ctx) {
return ctx.begin();
}
Expand Down Expand Up @@ -384,7 +382,7 @@ template <typename Char> struct formatter<std::error_code, Char> {
FMT_EXPORT
template <typename T, typename Char>
struct formatter<
T, Char, // DEPRECATED! Mixing code unit types.
T, Char, // DEPRECATED! Mixing code unit types.
typename std::enable_if<std::is_base_of<std::exception, T>::value>::type> {
private:
bool with_typename_ = false;
Expand Down Expand Up @@ -415,7 +413,7 @@ struct formatter<
# ifdef FMT_HAS_ABI_CXA_DEMANGLE
int status = 0;
std::size_t size = 0;
std::unique_ptr<char, void(*)(void*)> demangled_name_ptr(
std::unique_ptr<char, void (*)(void*)> demangled_name_ptr(
abi::__cxa_demangle(ti.name(), nullptr, &size, &status), &std::free);

string_view demangled_name_view;
Expand Down
10 changes: 5 additions & 5 deletions include/fmt/xchar.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ inline auto vformat_to(
return detail::get_iterator(buf, out);
}

template <
typename OutputIt, typename Locale, typename S, typename... T,
typename Char = char_t<S>,
bool enable = detail::is_output_iterator<OutputIt, Char>::value&&
detail::is_locale<Locale>::value&& detail::is_exotic_char<Char>::value>
template <typename OutputIt, typename Locale, typename S, typename... T,
typename Char = char_t<S>,
bool enable = detail::is_output_iterator<OutputIt, Char>::value &&
detail::is_locale<Locale>::value &&
detail::is_exotic_char<Char>::value>
inline auto format_to(OutputIt out, const Locale& loc, const S& format_str,
T&&... args) ->
typename std::enable_if<enable, OutputIt>::type {
Expand Down
2 changes: 1 addition & 1 deletion src/fmt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ extern "C++" {

// gcc doesn't yet implement private module fragments
#if !FMT_GCC_VERSION
module : private;
module :private;
#endif

#include "format.cc"
Expand Down

0 comments on commit 6855bd5

Please sign in to comment.