mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 10:47:35 +02:00
Remove unnecessary checks
This commit is contained in:
@ -2092,6 +2092,9 @@ auto write_int(OutputIt out, UInt value, unsigned prefix,
|
|||||||
int num_digits = 0;
|
int num_digits = 0;
|
||||||
auto buffer = memory_buffer();
|
auto buffer = memory_buffer();
|
||||||
switch (specs.type) {
|
switch (specs.type) {
|
||||||
|
default:
|
||||||
|
FMT_ASSERT(false, "");
|
||||||
|
FMT_FALLTHROUGH;
|
||||||
case presentation_type::none:
|
case presentation_type::none:
|
||||||
case presentation_type::dec: {
|
case presentation_type::dec: {
|
||||||
num_digits = count_digits(value);
|
num_digits = count_digits(value);
|
||||||
@ -2127,8 +2130,6 @@ auto write_int(OutputIt out, UInt value, unsigned prefix,
|
|||||||
}
|
}
|
||||||
case presentation_type::chr:
|
case presentation_type::chr:
|
||||||
return write_char(out, static_cast<Char>(value), specs);
|
return write_char(out, static_cast<Char>(value), specs);
|
||||||
default:
|
|
||||||
throw_format_error("invalid format specifier");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned size = (prefix != 0 ? prefix >> 24 : 0) + to_unsigned(num_digits) +
|
unsigned size = (prefix != 0 ? prefix >> 24 : 0) + to_unsigned(num_digits) +
|
||||||
@ -2200,6 +2201,9 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg,
|
|||||||
auto abs_value = arg.abs_value;
|
auto abs_value = arg.abs_value;
|
||||||
auto prefix = arg.prefix;
|
auto prefix = arg.prefix;
|
||||||
switch (specs.type) {
|
switch (specs.type) {
|
||||||
|
default:
|
||||||
|
FMT_ASSERT(false, "");
|
||||||
|
FMT_FALLTHROUGH;
|
||||||
case presentation_type::none:
|
case presentation_type::none:
|
||||||
case presentation_type::dec: {
|
case presentation_type::dec: {
|
||||||
auto num_digits = count_digits(abs_value);
|
auto num_digits = count_digits(abs_value);
|
||||||
@ -2243,8 +2247,6 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg,
|
|||||||
}
|
}
|
||||||
case presentation_type::chr:
|
case presentation_type::chr:
|
||||||
return write_char(out, static_cast<Char>(abs_value), specs);
|
return write_char(out, static_cast<Char>(abs_value), specs);
|
||||||
default:
|
|
||||||
throw_format_error("invalid format specifier");
|
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@ -2448,6 +2450,9 @@ FMT_CONSTEXPR auto parse_float_type_spec(const format_specs<Char>& specs)
|
|||||||
result.showpoint = specs.alt;
|
result.showpoint = specs.alt;
|
||||||
result.locale = specs.localized;
|
result.locale = specs.localized;
|
||||||
switch (specs.type) {
|
switch (specs.type) {
|
||||||
|
default:
|
||||||
|
FMT_ASSERT(false, "");
|
||||||
|
FMT_FALLTHROUGH;
|
||||||
case presentation_type::none:
|
case presentation_type::none:
|
||||||
result.format = float_format::general;
|
result.format = float_format::general;
|
||||||
break;
|
break;
|
||||||
@ -2477,9 +2482,6 @@ FMT_CONSTEXPR auto parse_float_type_spec(const format_specs<Char>& specs)
|
|||||||
case presentation_type::hexfloat_lower:
|
case presentation_type::hexfloat_lower:
|
||||||
result.format = float_format::hex;
|
result.format = float_format::hex;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
throw_format_error("invalid format specifier");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user