diff --git a/include/fmt/base.h b/include/fmt/base.h index f7de3759..05b636d9 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -467,8 +467,7 @@ template constexpr const char* narrow(const T*) { return nullptr; } constexpr FMT_ALWAYS_INLINE const char* narrow(const char* s) { return s; } template -FMT_CONSTEXPR auto compare(const Char* s1, const Char* s2, std::size_t n) - -> int { +FMT_CONSTEXPR auto compare(const Char* s1, const Char* s2, size_t n) -> int { if (!is_constant_evaluated() && sizeof(Char) == 1) return memcmp(s1, s2, n); for (; n != 0; ++s1, ++s2, --n) { if (*s1 < *s2) return -1; diff --git a/include/fmt/format.h b/include/fmt/format.h index 50e57144..13e30f6b 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2274,7 +2274,7 @@ inline auto write_significand(Char* out, UInt significand, int significand_size, int floating_size = significand_size - integral_size; for (int i = floating_size / 2; i > 0; --i) { out -= 2; - write2digits(out, static_cast(significand % 100)); + write2digits(out, static_cast(significand % 100)); significand /= 100; } if (floating_size % 2 != 0) { diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index 23ff7de0..a712008d 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -45,12 +45,11 @@ template class is_set { }; // C array overload -template +template auto range_begin(const T (&arr)[N]) -> const T* { return arr; } -template -auto range_end(const T (&arr)[N]) -> const T* { +template auto range_end(const T (&arr)[N]) -> const T* { return arr + N; } @@ -208,7 +207,7 @@ template using result_t = std::tuple, Char>...>; using std::get; -template +template auto get_formatters(index_sequence) -> result_t(std::declval()))...>; } // namespace tuple @@ -219,7 +218,7 @@ template struct range_reference_type_impl { using type = decltype(*detail::range_begin(std::declval())); }; -template struct range_reference_type_impl { +template struct range_reference_type_impl { using type = T&; }; diff --git a/include/fmt/std.h b/include/fmt/std.h index dc1e7832..5fea3fd7 100644 --- a/include/fmt/std.h +++ b/include/fmt/std.h @@ -123,10 +123,6 @@ auto write_escaped_alternative(OutputIt out, const T& v) -> OutputIt { #if FMT_CPP_LIB_VARIANT -template -using variant_index_sequence = - std::make_index_sequence::value>; - template struct is_variant_like_ : std::false_type {}; template struct is_variant_like_> : std::true_type {}; @@ -138,8 +134,8 @@ template class is_variant_formattable { check(std::index_sequence); public: - static constexpr const bool value = - decltype(check(variant_index_sequence{}))::value; + static constexpr const bool value = decltype(check( + std::make_index_sequence::value>()))::value; }; #endif // FMT_CPP_LIB_VARIANT @@ -318,7 +314,7 @@ template struct formatter, Char> : nested_formatter, Char> { private: - // This is functor because C++11 doesn't support generic lambdas. + // This is a functor because C++11 doesn't support generic lambdas. struct writer { const std::bitset& bs; diff --git a/src/os.cc b/src/os.cc index c833a051..740e345d 100644 --- a/src/os.cc +++ b/src/os.cc @@ -66,14 +66,14 @@ using rwresult = int; // On Windows the count argument to read and write is unsigned, so convert // it from size_t preventing integer overflow. -inline unsigned convert_rwcount(std::size_t count) { +inline unsigned convert_rwcount(size_t count) { return count <= UINT_MAX ? static_cast(count) : UINT_MAX; } #elif FMT_USE_FCNTL // Return type of read and write functions. using rwresult = ssize_t; -inline std::size_t convert_rwcount(std::size_t count) { return count; } +inline size_t convert_rwcount(size_t count) { return count; } #endif } // namespace @@ -266,7 +266,7 @@ long long file::size() const { # endif } -std::size_t file::read(void* buffer, std::size_t count) { +size_t file::read(void* buffer, size_t count) { rwresult result = 0; FMT_RETRY(result, FMT_POSIX_CALL(read(fd_, buffer, convert_rwcount(count)))); if (result < 0) @@ -274,7 +274,7 @@ std::size_t file::read(void* buffer, std::size_t count) { return detail::to_unsigned(result); } -std::size_t file::write(const void* buffer, std::size_t count) { +size_t file::write(const void* buffer, size_t count) { rwresult result = 0; FMT_RETRY(result, FMT_POSIX_CALL(write(fd_, buffer, convert_rwcount(count)))); if (result < 0)