Everywhere: Remove 'clang-format off' comments that are no longer needed

This commit is contained in:
Timothy Flynn 2023-07-07 22:59:01 -04:00 committed by Linus Groh
parent c911781c21
commit 996c020b0d
Notes: sideshowbarker 2024-07-17 08:25:15 +09:00
6 changed files with 42 additions and 57 deletions

View file

@ -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); constexpr size_t max_big_int_length = 1 << (word_size == 32 ? 26 : 29);
// ===== Static storage for big integers ===== // ===== Static storage for big integers =====
// FIXME: remove once Clang formats these properly.
// clang-format off
template<typename T, typename WordType = NativeWord> template<typename T, typename WordType = NativeWord>
concept IntegerStorage = requires(T storage, size_t index) concept IntegerStorage = requires(T storage, size_t index) {
{ {
{ storage.is_negative() } -> SameAs<bool>; storage.is_negative()
{ storage.size() } -> SameAs<size_t>; } -> SameAs<bool>;
{ storage[index] } -> ConvertibleTo<WordType&>; {
{ storage.data() } -> ConvertibleTo<WordType*>; storage.size()
} -> SameAs<size_t>;
{
storage[index]
} -> ConvertibleTo<WordType&>;
{
storage.data()
} -> ConvertibleTo<WordType*>;
}; };
template<typename T> template<typename T>
concept IntegerReadonlyStorage = IntegerStorage<T, NativeWord const>; concept IntegerReadonlyStorage = IntegerStorage<T, NativeWord const>;
// clang-format on
struct NullAllocator { struct NullAllocator {
NativeWord* allocate(size_t) { VERIFY_NOT_REACHED(); } NativeWord* allocate(size_t) { VERIFY_NOT_REACHED(); }

View file

@ -57,13 +57,9 @@ concept AnyString = IsConstructible<StringView, RemoveCVReference<T> const&>;
template<typename T, typename U> template<typename T, typename U>
concept HashCompatible = IsHashCompatible<Detail::Decay<T>, Detail::Decay<U>>; concept HashCompatible = IsHashCompatible<Detail::Decay<T>, Detail::Decay<U>>;
// FIXME: remove once Clang formats these properly.
// clang-format off
// Any indexable, sized, contiguous data structure. // Any indexable, sized, contiguous data structure.
template<typename ArrayT, typename ContainedT, typename SizeT = size_t> template<typename ArrayT, typename ContainedT, typename SizeT = size_t>
concept ArrayLike = requires(ArrayT array, SizeT index) concept ArrayLike = requires(ArrayT array, SizeT index) {
{
{ {
array[index] array[index]
} }
@ -87,8 +83,7 @@ concept ArrayLike = requires(ArrayT array, SizeT index)
// Any indexable data structure. // Any indexable data structure.
template<typename ArrayT, typename ContainedT, typename SizeT = size_t> template<typename ArrayT, typename ContainedT, typename SizeT = size_t>
concept Indexable = requires(ArrayT array, SizeT index) concept Indexable = requires(ArrayT array, SizeT index) {
{
{ {
array[index] array[index]
} }
@ -96,8 +91,7 @@ concept Indexable = requires(ArrayT array, SizeT index)
}; };
template<typename Func, typename... Args> template<typename Func, typename... Args>
concept VoidFunction = requires(Func func, Args... args) concept VoidFunction = requires(Func func, Args... args) {
{
{ {
func(args...) func(args...)
} }
@ -105,8 +99,7 @@ concept VoidFunction = requires(Func func, Args... args)
}; };
template<typename Func, typename... Args> template<typename Func, typename... Args>
concept IteratorFunction = requires(Func func, Args... args) concept IteratorFunction = requires(Func func, Args... args) {
{
{ {
func(args...) func(args...)
} }
@ -114,17 +107,19 @@ concept IteratorFunction = requires(Func func, Args... args)
}; };
template<typename T, typename EndT> template<typename T, typename EndT>
concept IteratorPairWith = requires(T it, EndT end) concept IteratorPairWith = requires(T it, EndT end) {
{
*it; *it;
{ it != end } -> SameAs<bool>; {
it != end
} -> SameAs<bool>;
++it; ++it;
}; };
template<typename T> template<typename T>
concept IterableContainer = requires concept IterableContainer = requires {
{ {
{ declval<T>().begin() } -> IteratorPairWith<decltype(declval<T>().end())>; declval<T>().begin()
} -> IteratorPairWith<decltype(declval<T>().end())>;
}; };
template<typename Func, typename... Args> template<typename Func, typename... Args>
@ -134,7 +129,6 @@ concept FallibleFunction = requires(Func&& func, Args&&... args) {
func(forward<Args>(args)...).release_value(); func(forward<Args>(args)...).release_value();
}; };
// clang-format on
} }
#if !USING_AK_GLOBALLY #if !USING_AK_GLOBALLY

View file

@ -487,9 +487,7 @@ public:
[[nodiscard]] i64 truncated_seconds() const { return m_offset.to_truncated_seconds(); } [[nodiscard]] i64 truncated_seconds() const { return m_offset.to_truncated_seconds(); }
[[nodiscard]] i64 nanoseconds_within_second() const { return to_timespec().tv_nsec; } [[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; } 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 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 }; } constexpr MonotonicTime operator+(Duration const& other) const { return MonotonicTime { m_offset + other }; }

View file

@ -52,13 +52,10 @@ static int memfd_create(char const* name, unsigned int flags)
} \ } \
return success_value; return success_value;
// clang-format off
template<typename T> template<typename T>
concept SupportsReentrantGetpwent = requires(T passwd, T* ptr) concept SupportsReentrantGetpwent = requires(T passwd, T* ptr) {
{
getpwent_r(&passwd, nullptr, 0, &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 // 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. // into finding a declaration of getpwent_r when it doesn't actually exist.
@ -86,13 +83,10 @@ static ErrorOr<Optional<struct passwd>> getpwent_impl(Span<char> buffer)
return Optional<struct passwd> {}; return Optional<struct passwd> {};
} }
// clang-format off
template<typename T> template<typename T>
concept SupportsReentrantGetgrent = requires(T group, T* ptr) concept SupportsReentrantGetgrent = requires(T group, T* ptr) {
{
getgrent_r(&group, nullptr, 0, &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 // 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. // into finding a declaration of getgrent_r when it doesn't actually exist.

View file

@ -116,17 +116,14 @@ void CRC32::update(ReadonlyBytes data)
auto low = *segment ^ m_state; auto low = *segment ^ m_state;
auto high = *(++segment); 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] m_state = table[0][(high >> 24) & 0xff]
^ table[1][(high >> 16) & 0xff] ^ table[1][(high >> 16) & 0xff]
^ table[2][(high >> 8) & 0xff] ^ table[2][(high >> 8) & 0xff]
^ table[3][high & 0xff] ^ table[3][high & 0xff]
^ table[4][(low >> 24) & 0xff] ^ table[4][(low >> 24) & 0xff]
^ table[5][(low >> 16) & 0xff] ^ table[5][(low >> 16) & 0xff]
^ table[6][(low >> 8) & 0xff] ^ table[6][(low >> 8) & 0xff]
^ table[7][low & 0xff]; ^ table[7][low & 0xff];
// clang-format on
aligned_data = aligned_data.slice(8); aligned_data = aligned_data.slice(8);
} }

View file

@ -36,17 +36,15 @@ struct MatchedRoute {
Vector<String> parameters; Vector<String> parameters;
}; };
// clang-format off #define ROUTE(method, path, handler) \
// This would be formatted rather badly. Route \
#define ROUTE(method, path, handler) \ { \
Route { \ HTTP::HttpRequest::method, \
HTTP::HttpRequest::method, \ path, \
path, \ [](auto& client, auto parameters, auto payload) { \
[](auto& client, auto parameters, auto payload) { \ return client.handler(parameters, move(payload)); \
return client.handler(parameters, move(payload)); \ } \
} \
} }
// clang-format on
// https://w3c.github.io/webdriver/#dfn-endpoints // https://w3c.github.io/webdriver/#dfn-endpoints
static constexpr auto s_webdriver_endpoints = Array { static constexpr auto s_webdriver_endpoints = Array {