mirror of
https://github.com/transmission/transmission.git
synced 2026-02-14 23:19:34 +00:00
chore(core): fix modernize-use-constraints (#8236)
This commit is contained in:
@@ -3,7 +3,6 @@ HeaderFilterRegex: .*/libtransmission/.*
|
||||
|
||||
# TODO: Enable `portability-template-virtual-member-function` after https://github.com/llvm/llvm-project/issues/139031 is fixed
|
||||
# TODO: Enable `cppcoreguidelines-pro-bounds-pointer-arithmetic` after converting all pointers to std::span
|
||||
# TODO: Enable `modernize-use-constraints` after GCC >= 10, clang 10
|
||||
# TODO: Enable `modernize-use-integer-sign-comparison` (P0586R2) after GCC >= 10.1, clang >= 13
|
||||
# PRs welcome to fix & re-enable any of these explicitly-disabled checks
|
||||
#
|
||||
@@ -45,7 +44,6 @@ Checks: >
|
||||
-misc-non-private-member-variables-in-classes,
|
||||
modernize-*,
|
||||
-modernize-loop-convert,
|
||||
-modernize-use-constraints,
|
||||
-modernize-use-integer-sign-comparison,
|
||||
-modernize-use-ranges,
|
||||
-modernize-use-trailing-return-type,
|
||||
|
||||
@@ -809,8 +809,9 @@ std::string_view tr_get_mime_type_for_filename(std::string_view filename)
|
||||
|
||||
// --- tr_num_parse()
|
||||
|
||||
template<typename T, std::enable_if_t<std::is_integral_v<T>, bool>>
|
||||
template<typename T>
|
||||
[[nodiscard]] std::optional<T> tr_num_parse(std::string_view str, std::string_view* remainder, int base)
|
||||
requires std::is_integral_v<T>
|
||||
{
|
||||
auto val = T{};
|
||||
auto const* const begin_ch = std::data(str);
|
||||
@@ -839,8 +840,9 @@ template std::optional<unsigned int> tr_num_parse(std::string_view str, std::str
|
||||
template std::optional<unsigned short> tr_num_parse(std::string_view str, std::string_view* remainder, int base);
|
||||
template std::optional<unsigned char> tr_num_parse(std::string_view str, std::string_view* remainder, int base);
|
||||
|
||||
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool>>
|
||||
template<typename T>
|
||||
[[nodiscard]] std::optional<T> tr_num_parse(std::string_view str, std::string_view* remainder)
|
||||
requires std::is_floating_point_v<T>
|
||||
{
|
||||
auto const* const begin_ch = std::data(str);
|
||||
auto const* const end_ch = begin_ch + std::size(str);
|
||||
|
||||
@@ -207,11 +207,13 @@ constexpr bool tr_strv_sep(std::string_view* sv, std::string_view* token, Args&&
|
||||
|
||||
// ---
|
||||
|
||||
template<typename T, std::enable_if_t<std::is_integral_v<T>, bool> = true>
|
||||
[[nodiscard]] std::optional<T> tr_num_parse(std::string_view str, std::string_view* setme_remainder = nullptr, int base = 10);
|
||||
template<typename T>
|
||||
[[nodiscard]] std::optional<T> tr_num_parse(std::string_view str, std::string_view* setme_remainder = nullptr, int base = 10)
|
||||
requires std::is_integral_v<T>;
|
||||
|
||||
template<typename T, std::enable_if_t<std::is_floating_point_v<T>, bool> = true>
|
||||
[[nodiscard]] std::optional<T> tr_num_parse(std::string_view str, std::string_view* setme_remainder = nullptr);
|
||||
template<typename T>
|
||||
[[nodiscard]] std::optional<T> tr_num_parse(std::string_view str, std::string_view* setme_remainder = nullptr)
|
||||
requires std::is_floating_point_v<T>;
|
||||
|
||||
/**
|
||||
* @brief Given a string like "1-4" or "1-4,6,9,14-51", this returns a
|
||||
|
||||
Reference in New Issue
Block a user