From 7e4df6c7e11d92398d0e8ab7534716db06831ed0 Mon Sep 17 00:00:00 2001 From: "Alan M. Carroll" Date: Tue, 28 Nov 2023 13:23:32 -0600 Subject: [PATCH] Clang format. --- code/include/swoc/Errata.h | 3 ++- code/include/swoc/TextView.h | 6 ++++-- code/include/swoc/swoc_meta.h | 14 +++++--------- unit_tests/test_meta.cc | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/code/include/swoc/Errata.h b/code/include/swoc/Errata.h index d765ef7..5cbf46d 100644 --- a/code/include/swoc/Errata.h +++ b/code/include/swoc/Errata.h @@ -1121,7 +1121,8 @@ Errata::assign(code_type code) -> self_type & { return *this; } -inline bool Errata::has_severity() const { +inline bool +Errata::has_severity() const { return _data && _data->_severity.has_value(); } inline auto diff --git a/code/include/swoc/TextView.h b/code/include/swoc/TextView.h index 98ef55c..05b224a 100644 --- a/code/include/swoc/TextView.h +++ b/code/include/swoc/TextView.h @@ -1108,11 +1108,13 @@ inline constexpr CharSet::CharSet(TextView const &chars) { } } -inline bool CharSet::operator()(unsigned char c) const { +inline bool +CharSet::operator()(unsigned char c) const { return _chars[c]; } -inline bool CharSet::operator()(char c) const { +inline bool +CharSet::operator()(char c) const { return _chars[uint8_t(c)]; } diff --git a/code/include/swoc/swoc_meta.h b/code/include/swoc/swoc_meta.h index 5c3855e..72dffaa 100644 --- a/code/include/swoc/swoc_meta.h +++ b/code/include/swoc/swoc_meta.h @@ -257,8 +257,8 @@ template struct type_list { template struct let { using self_type = let; - let(self_type const& that) = delete; - self_type & operator = (self_type const&) = delete; + let(self_type const &that) = delete; + self_type &operator=(self_type const &) = delete; T &_var; ///< Reference to scoped variable. T _value; ///< Original value. @@ -280,19 +280,15 @@ template struct let { ~let(); }; -template let::let(T &var, T const &value) : _var(var), _value(std::move(var)) -{ +template let::let(T &var, T const &value) : _var(var), _value(std::move(var)) { _var = value; } -template let::let(T &var, T &&value) : _var(var), _value(std::move(var)) -{ +template let::let(T &var, T &&value) : _var(var), _value(std::move(var)) { _var = std::move(value); } -template let::~let() -{ +template let::~let() { _var = std::move(_value); } - }}} // namespace swoc::SWOC_VERSION_NS::meta diff --git a/unit_tests/test_meta.cc b/unit_tests/test_meta.cc index 782bae4..d0d6ec5 100644 --- a/unit_tests/test_meta.cc +++ b/unit_tests/test_meta.cc @@ -110,7 +110,7 @@ TEST_CASE("Meta let", "[meta][let]") { std::string s{"Evil Dave Rulz With An Iron Keyboard"}; // force allocation. auto sptr = s.data(); { - char const * text = "Twas brillig and the slithy toves"; + char const *text = "Twas brillig and the slithy toves"; let guard(s, std::string(text)); REQUIRE(s == text); REQUIRE(s.data() != sptr);