From 088f66c385b730ce3791fc03247d5b2078566cee Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 26 Jun 2020 15:58:42 +0200 Subject: [PATCH] Style fixes. --- src/String/BasicStringView.hpp | 3 +-- src/String/StringView.hpp | 4 +++- tests/ConstStringTests.cpp | 4 +--- tests/ListTests.cpp | 1 - tests/UniquePtrListTests.cpp | 1 - 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/String/BasicStringView.hpp b/src/String/BasicStringView.hpp index b7dfca8..0fc1b36 100644 --- a/src/String/BasicStringView.hpp +++ b/src/String/BasicStringView.hpp @@ -9,8 +9,8 @@ namespace ArbUt { uint32_t _hash; constexpr BasicStringView(size_t length, uint32_t hash) : _length(length), _hash(hash) {} - public: + public: [[nodiscard]] inline constexpr size_t Length() const noexcept { return _length; } [[nodiscard]] inline constexpr uint32_t GetHash() const noexcept { return _hash; } [[nodiscard]] inline constexpr std::size_t operator()(BasicStringView const& s) const noexcept { return _hash; } @@ -28,7 +28,6 @@ namespace ArbUt { virtual constexpr bool operator!=(const std::string_view& rhs) const noexcept = 0; virtual constexpr bool operator==(const char* rhs) const noexcept = 0; virtual constexpr bool operator!=(const char* rhs) const noexcept = 0; - }; } diff --git a/src/String/StringView.hpp b/src/String/StringView.hpp index d4502c2..c5563e6 100644 --- a/src/String/StringView.hpp +++ b/src/String/StringView.hpp @@ -92,7 +92,9 @@ namespace ArbUt { inline constexpr bool operator!=(const char* rhs) const noexcept override { return _hash != Hash(rhs); } inline static constexpr uint32_t CalculateHash(const char* val) noexcept { return Hash(val); } - inline static constexpr uint32_t CalculateHash(const std::string_view& val) noexcept { return Hash(val.data()); } + inline static constexpr uint32_t CalculateHash(const std::string_view& val) noexcept { + return Hash(val.data()); + } }; } diff --git a/tests/ConstStringTests.cpp b/tests/ConstStringTests.cpp index e45b6bb..3038bc0 100644 --- a/tests/ConstStringTests.cpp +++ b/tests/ConstStringTests.cpp @@ -9,9 +9,7 @@ TEST_CASE("Initialize compile time", "[Utilities]") { static_assert("bar"_cnc.Length() == 3); } -TEST_CASE("Compare compile time", "[Utilities]") { - static_assert("foo"_cnc != "bar"_cnc); -} +TEST_CASE("Compare compile time", "[Utilities]") { static_assert("foo"_cnc != "bar"_cnc); } TEST_CASE("Compare compile time with CaseInsensitiveConstString", "[Utilities]") { static_assert("foo"_cnc == ArbUt::StringViewLiteral("foo")); diff --git a/tests/ListTests.cpp b/tests/ListTests.cpp index 3495dd8..22d87c1 100644 --- a/tests/ListTests.cpp +++ b/tests/ListTests.cpp @@ -73,5 +73,4 @@ TEST_CASE("Test list out of bounds", "[Utilities]") { REQUIRE_THROWS(ls.At(7)); } - #endif \ No newline at end of file diff --git a/tests/UniquePtrListTests.cpp b/tests/UniquePtrListTests.cpp index d125cfa..05e775b 100644 --- a/tests/UniquePtrListTests.cpp +++ b/tests/UniquePtrListTests.cpp @@ -51,5 +51,4 @@ TEST_CASE("Test unique ptr list out of bounds", "[Utilities]") { REQUIRE_THROWS(ls.At(2)); } - #endif \ No newline at end of file