From 08f98c7fac057c00f6298c789efadf923ef6ccb3 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 3 Sep 2021 21:17:36 -0700 Subject: [PATCH] Simplify get_arg_index_by_name --- include/fmt/core.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 55322032..ca751d3a 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -2701,12 +2701,10 @@ constexpr auto get_arg_index_by_name(basic_string_view name) -> int { if constexpr (detail::is_statically_named_arg()) { if (name == T::name) return N; } - if constexpr (sizeof...(Args) > 0) { + if constexpr (sizeof...(Args) > 0) return get_arg_index_by_name(name); - } else { - (void)name; // Workaround an MSVC bug about "unused" parameter. - return invalid_arg_index; - } + (void)name; // Workaround an MSVC bug about "unused" parameter. + return invalid_arg_index; } #endif