Skip to content

Commit b41a54d

Browse files
committed
fix clickhouse: do not use fmt::detail
Usage of `fmt::detail` leads to unexpected tests failures ------------------------ Note: by creating a PR or an issue you automatically agree to the CLA. See [CONTRIBUTING.md](https://github.com/userver-framework/userver/blob/develop/CONTRIBUTING.md). Feel free to remove this note, the agreement holds. Tests: протестировано CI Pull Request resolved: #940 commit_hash:b40ac3aba4bec8a4eeec987e79bc7a1e7b79b87b
1 parent bc9620c commit b41a54d

1 file changed

Lines changed: 1 addition & 31 deletions

File tree

clickhouse/include/userver/storages/clickhouse/io/floating_point_types.hpp

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
/// @file userver/storages/clickhouse/io/floating_point_types.hpp
44
/// @brief @copybrief storages::clickhouse::io::FloatingWithPrecision
55

6-
#if FMT_VERSION >= 110000
7-
#include <fmt/base.h> // Y_IGNORE
8-
#endif
96
#include <fmt/format.h>
107

118
USERVER_NAMESPACE_BEGIN
@@ -47,38 +44,11 @@ class FloatingWithPrecision {
4744
return *this;
4845
}
4946

50-
std::string ToString() {
51-
std::string result;
52-
fmt::detail::write(std::back_inserter(result), value_, spec_);
53-
return result;
54-
}
47+
std::string ToString() { return fmt::format("{:.{}f}", value_, Precision); }
5548

5649
private:
5750
FloatingPointT value_;
5851

59-
#if FMT_VERSION >= 110100
60-
constexpr static fmt::format_specs spec_ = []() {
61-
fmt::format_specs spec;
62-
spec.precision = Precision;
63-
spec.set_type(fmt::presentation_type::fixed);
64-
return spec;
65-
}();
66-
#elif FMT_VERSION >= 110000
67-
constexpr static fmt::format_specs spec_ = []() {
68-
fmt::format_specs spec;
69-
spec.precision = Precision;
70-
spec.type = fmt::presentation_type::fixed;
71-
return spec;
72-
}();
73-
#else
74-
constexpr static fmt::basic_format_specs<char> spec_ = []() {
75-
fmt::basic_format_specs<char> spec;
76-
spec.precision = Precision;
77-
spec.type = fmt::presentation_type::fixed_lower;
78-
return spec;
79-
}();
80-
#endif
81-
8252
template <typename U, std::uint32_t AnotherPrecision, typename>
8353
friend class FloatingWithPrecision;
8454
};

0 commit comments

Comments
 (0)