From 996c020b0d098d27c762ae2c3e422cc1dc535ecd Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Fri, 7 Jul 2023 22:59:01 -0400 Subject: [PATCH] Everywhere: Remove 'clang-format off' comments that are no longer needed --- AK/BigIntBase.h | 22 ++++++++------ AK/Concepts.h | 30 ++++++++----------- AK/Time.h | 2 -- Userland/Libraries/LibCore/System.cpp | 10 ++----- .../Libraries/LibCrypto/Checksum/CRC32.cpp | 17 +++++------ .../Libraries/LibWeb/WebDriver/Client.cpp | 18 +++++------ 6 files changed, 42 insertions(+), 57 deletions(-) diff --git a/AK/BigIntBase.h b/AK/BigIntBase.h index 20212ae9cc2..cc481d2f0fe 100644 --- a/AK/BigIntBase.h +++ b/AK/BigIntBase.h @@ -43,20 +43,24 @@ static_assert(word_size == 32 || word_size == 64); constexpr size_t max_big_int_length = 1 << (word_size == 32 ? 26 : 29); // ===== Static storage for big integers ===== -// FIXME: remove once Clang formats these properly. -// clang-format off template -concept IntegerStorage = requires(T storage, size_t index) -{ - { storage.is_negative() } -> SameAs; - { storage.size() } -> SameAs; - { storage[index] } -> ConvertibleTo; - { storage.data() } -> ConvertibleTo; +concept IntegerStorage = requires(T storage, size_t index) { + { + storage.is_negative() + } -> SameAs; + { + storage.size() + } -> SameAs; + { + storage[index] + } -> ConvertibleTo; + { + storage.data() + } -> ConvertibleTo; }; template concept IntegerReadonlyStorage = IntegerStorage; -// clang-format on struct NullAllocator { NativeWord* allocate(size_t) { VERIFY_NOT_REACHED(); } diff --git a/AK/Concepts.h b/AK/Concepts.h index 66737cc9716..461f776472f 100644 --- a/AK/Concepts.h +++ b/AK/Concepts.h @@ -57,13 +57,9 @@ concept AnyString = IsConstructible const&>; template concept HashCompatible = IsHashCompatible, Detail::Decay>; -// FIXME: remove once Clang formats these properly. -// clang-format off - // Any indexable, sized, contiguous data structure. template -concept ArrayLike = requires(ArrayT array, SizeT index) -{ +concept ArrayLike = requires(ArrayT array, SizeT index) { { array[index] } @@ -87,8 +83,7 @@ concept ArrayLike = requires(ArrayT array, SizeT index) // Any indexable data structure. template -concept Indexable = requires(ArrayT array, SizeT index) -{ +concept Indexable = requires(ArrayT array, SizeT index) { { array[index] } @@ -96,8 +91,7 @@ concept Indexable = requires(ArrayT array, SizeT index) }; template -concept VoidFunction = requires(Func func, Args... args) -{ +concept VoidFunction = requires(Func func, Args... args) { { func(args...) } @@ -105,8 +99,7 @@ concept VoidFunction = requires(Func func, Args... args) }; template -concept IteratorFunction = requires(Func func, Args... args) -{ +concept IteratorFunction = requires(Func func, Args... args) { { func(args...) } @@ -114,17 +107,19 @@ concept IteratorFunction = requires(Func func, Args... args) }; template -concept IteratorPairWith = requires(T it, EndT end) -{ +concept IteratorPairWith = requires(T it, EndT end) { *it; - { it != end } -> SameAs; + { + it != end + } -> SameAs; ++it; }; template -concept IterableContainer = requires -{ - { declval().begin() } -> IteratorPairWith().end())>; +concept IterableContainer = requires { + { + declval().begin() + } -> IteratorPairWith().end())>; }; template @@ -134,7 +129,6 @@ concept FallibleFunction = requires(Func&& func, Args&&... args) { func(forward(args)...).release_value(); }; -// clang-format on } #if !USING_AK_GLOBALLY diff --git a/AK/Time.h b/AK/Time.h index ab30bb41e66..8f6e116da11 100644 --- a/AK/Time.h +++ b/AK/Time.h @@ -487,9 +487,7 @@ public: [[nodiscard]] i64 truncated_seconds() const { return m_offset.to_truncated_seconds(); } [[nodiscard]] i64 nanoseconds_within_second() const { return to_timespec().tv_nsec; } - // clang-format off constexpr bool operator==(MonotonicTime const& other) const { return this->m_offset == other.m_offset; } - // clang-format on constexpr int operator<=>(MonotonicTime const& other) const { return this->m_offset <=> other.m_offset; } constexpr MonotonicTime operator+(Duration const& other) const { return MonotonicTime { m_offset + other }; } diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index 7cacceda788..c26bc0ace15 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -52,13 +52,10 @@ static int memfd_create(char const* name, unsigned int flags) } \ return success_value; -// clang-format off template -concept SupportsReentrantGetpwent = requires(T passwd, T* ptr) -{ +concept SupportsReentrantGetpwent = requires(T passwd, T* ptr) { getpwent_r(&passwd, nullptr, 0, &ptr); }; -// clang-format on // Note: This has to be in the global namespace for the extern declaration to trick the compiler // into finding a declaration of getpwent_r when it doesn't actually exist. @@ -86,13 +83,10 @@ static ErrorOr> getpwent_impl(Span buffer) return Optional {}; } -// clang-format off template -concept SupportsReentrantGetgrent = requires(T group, T* ptr) -{ +concept SupportsReentrantGetgrent = requires(T group, T* ptr) { getgrent_r(&group, nullptr, 0, &ptr); }; -// clang-format on // Note: This has to be in the global namespace for the extern declaration to trick the compiler // into finding a declaration of getgrent_r when it doesn't actually exist. diff --git a/Userland/Libraries/LibCrypto/Checksum/CRC32.cpp b/Userland/Libraries/LibCrypto/Checksum/CRC32.cpp index 8979ab1d49b..0f86b0d4c3e 100644 --- a/Userland/Libraries/LibCrypto/Checksum/CRC32.cpp +++ b/Userland/Libraries/LibCrypto/Checksum/CRC32.cpp @@ -116,17 +116,14 @@ void CRC32::update(ReadonlyBytes data) auto low = *segment ^ m_state; auto high = *(++segment); - // clang-format will put this all on one line, which is really hard to read. - // clang-format off m_state = table[0][(high >> 24) & 0xff] - ^ table[1][(high >> 16) & 0xff] - ^ table[2][(high >> 8) & 0xff] - ^ table[3][high & 0xff] - ^ table[4][(low >> 24) & 0xff] - ^ table[5][(low >> 16) & 0xff] - ^ table[6][(low >> 8) & 0xff] - ^ table[7][low & 0xff]; - // clang-format on + ^ table[1][(high >> 16) & 0xff] + ^ table[2][(high >> 8) & 0xff] + ^ table[3][high & 0xff] + ^ table[4][(low >> 24) & 0xff] + ^ table[5][(low >> 16) & 0xff] + ^ table[6][(low >> 8) & 0xff] + ^ table[7][low & 0xff]; aligned_data = aligned_data.slice(8); } diff --git a/Userland/Libraries/LibWeb/WebDriver/Client.cpp b/Userland/Libraries/LibWeb/WebDriver/Client.cpp index ae6217e6c92..27f7928e41f 100644 --- a/Userland/Libraries/LibWeb/WebDriver/Client.cpp +++ b/Userland/Libraries/LibWeb/WebDriver/Client.cpp @@ -36,17 +36,15 @@ struct MatchedRoute { Vector parameters; }; -// clang-format off -// This would be formatted rather badly. -#define ROUTE(method, path, handler) \ - Route { \ - HTTP::HttpRequest::method, \ - path, \ - [](auto& client, auto parameters, auto payload) { \ - return client.handler(parameters, move(payload)); \ - } \ +#define ROUTE(method, path, handler) \ + Route \ + { \ + HTTP::HttpRequest::method, \ + path, \ + [](auto& client, auto parameters, auto payload) { \ + return client.handler(parameters, move(payload)); \ + } \ } -// clang-format on // https://w3c.github.io/webdriver/#dfn-endpoints static constexpr auto s_webdriver_endpoints = Array {