Cleanup width handlers

This commit is contained in:
Victor Zverovich 2022-12-23 18:45:21 -08:00
parent 1dadeb8a33
commit 840ec8569d
4 changed files with 4 additions and 7 deletions

View File

@ -2020,7 +2020,6 @@ struct formatter<std::chrono::duration<Rep, Period>, Char> {
}
void on_error(const char* msg) { FMT_THROW(format_error(msg)); }
FMT_CONSTEXPR void on_width(int width) { f.specs.width = width; }
FMT_CONSTEXPR void on_precision(int _precision) {
f.precision = _precision;
}

View File

@ -2241,7 +2241,6 @@ template <typename Char> class specs_setter {
specs_.fill[0] = Char('0');
}
FMT_CONSTEXPR void on_width(int width) { specs_.width = width; }
FMT_CONSTEXPR void on_precision(int precision) {
specs_.precision = precision;
}
@ -2264,7 +2263,7 @@ class dynamic_specs_handler
FMT_CONSTEXPR auto parse_context() -> ParseContext& { return context_; }
FMT_CONSTEXPR void on_dynamic_width(const dynamic_spec<char_type>& width) {
FMT_CONSTEXPR void on_width(const dynamic_spec<char_type>& width) {
switch (width.kind) {
case dynamic_spec_kind::none:
break;
@ -2666,7 +2665,7 @@ FMT_CONSTEXPR FMT_INLINE auto parse_format_specs(const Char* begin,
}
auto width_result = parse_width(begin, end, handler.parse_context());
handler.on_dynamic_width(width_result.width);
handler.on_width(width_result.width);
begin = width_result.end;
if (begin == end) return begin;

View File

@ -3627,7 +3627,7 @@ template <typename Char> class specs_handler : public specs_setter<Char> {
return parse_context_;
}
FMT_CONSTEXPR void on_dynamic_width(const dynamic_spec<Char>& width) {
FMT_CONSTEXPR void on_width(const dynamic_spec<Char>& width) {
auto arg = format_arg();
switch (width.kind) {
case dynamic_spec_kind::none:

View File

@ -553,8 +553,7 @@ struct test_format_specs_handler {
constexpr void on_zero() { res = zero; }
constexpr void on_localized() { res = loc; }
constexpr void on_width(int w) { width = w; }
constexpr void on_dynamic_width(const fmt::detail::dynamic_spec<char>& spec) {
constexpr void on_width(const fmt::detail::dynamic_spec<char>& spec) {
switch (spec.kind) {
case fmt::detail::dynamic_spec_kind::none:
break;