mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 09:20:28 +03:00
Everywhere: Remove 'clang-format off' comments that are no longer needed
This commit is contained in:
parent
c911781c21
commit
996c020b0d
Notes:
sideshowbarker
2024-07-17 08:25:15 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/996c020b0d Pull-request: https://github.com/SerenityOS/serenity/pull/19876 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/BertalanD
@ -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<typename T, typename WordType = NativeWord>
|
||||
concept IntegerStorage = requires(T storage, size_t index)
|
||||
{
|
||||
{ storage.is_negative() } -> SameAs<bool>;
|
||||
{ storage.size() } -> SameAs<size_t>;
|
||||
{ storage[index] } -> ConvertibleTo<WordType&>;
|
||||
{ storage.data() } -> ConvertibleTo<WordType*>;
|
||||
concept IntegerStorage = requires(T storage, size_t index) {
|
||||
{
|
||||
storage.is_negative()
|
||||
} -> SameAs<bool>;
|
||||
{
|
||||
storage.size()
|
||||
} -> SameAs<size_t>;
|
||||
{
|
||||
storage[index]
|
||||
} -> ConvertibleTo<WordType&>;
|
||||
{
|
||||
storage.data()
|
||||
} -> ConvertibleTo<WordType*>;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
concept IntegerReadonlyStorage = IntegerStorage<T, NativeWord const>;
|
||||
// clang-format on
|
||||
|
||||
struct NullAllocator {
|
||||
NativeWord* allocate(size_t) { VERIFY_NOT_REACHED(); }
|
||||
|
@ -57,13 +57,9 @@ concept AnyString = IsConstructible<StringView, RemoveCVReference<T> const&>;
|
||||
template<typename T, typename 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.
|
||||
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]
|
||||
}
|
||||
@ -87,8 +83,7 @@ concept ArrayLike = requires(ArrayT array, SizeT index)
|
||||
|
||||
// Any indexable data structure.
|
||||
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]
|
||||
}
|
||||
@ -96,8 +91,7 @@ concept Indexable = requires(ArrayT array, SizeT index)
|
||||
};
|
||||
|
||||
template<typename Func, typename... Args>
|
||||
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<typename Func, typename... Args>
|
||||
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<typename T, typename EndT>
|
||||
concept IteratorPairWith = requires(T it, EndT end)
|
||||
{
|
||||
concept IteratorPairWith = requires(T it, EndT end) {
|
||||
*it;
|
||||
{ it != end } -> SameAs<bool>;
|
||||
{
|
||||
it != end
|
||||
} -> SameAs<bool>;
|
||||
++it;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
concept IterableContainer = requires
|
||||
{
|
||||
{ declval<T>().begin() } -> IteratorPairWith<decltype(declval<T>().end())>;
|
||||
concept IterableContainer = requires {
|
||||
{
|
||||
declval<T>().begin()
|
||||
} -> IteratorPairWith<decltype(declval<T>().end())>;
|
||||
};
|
||||
|
||||
template<typename Func, typename... Args>
|
||||
@ -134,7 +129,6 @@ concept FallibleFunction = requires(Func&& func, Args&&... args) {
|
||||
func(forward<Args>(args)...).release_value();
|
||||
};
|
||||
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
#if !USING_AK_GLOBALLY
|
||||
|
@ -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 }; }
|
||||
|
@ -52,13 +52,10 @@ static int memfd_create(char const* name, unsigned int flags)
|
||||
} \
|
||||
return success_value;
|
||||
|
||||
// clang-format off
|
||||
template<typename T>
|
||||
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<Optional<struct passwd>> getpwent_impl(Span<char> buffer)
|
||||
return Optional<struct passwd> {};
|
||||
}
|
||||
|
||||
// clang-format off
|
||||
template<typename T>
|
||||
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.
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -36,17 +36,15 @@ struct MatchedRoute {
|
||||
Vector<String> 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 {
|
||||
|
Loading…
Reference in New Issue
Block a user