Skip to content

Commit

Permalink
[#25536] docdb: Remove NOLINT from requires
Browse files Browse the repository at this point in the history
Summary:
Defining a concept as below used to lead to readability/braces errors:

```
template<typename T>
concept TestConcept = requires(T value) {
   // ...
};
```

We used to `// NOLINT` wherever this applied.

This lint error has been fixed, so removing the `// NOLINT` comments.
Jira: DB-14791

Test Plan: Jenkins: compile only

Reviewers: hsunder

Reviewed By: hsunder

Subscribers: yql, ybase

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D41090
  • Loading branch information
es1024 committed Jan 10, 2025
1 parent 66fd3f9 commit 9592939
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/yb/docdb/pgsql_operation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -621,12 +621,12 @@ template <typename T>
concept Prefetcher = requires(
T& key_provider, FilteringIterator& iterator, const dockv::ReaderProjection& projection) {
{ key_provider.Prefetch(iterator, projection) } -> std::same_as<Status>;
}; // NOLINT
};

template <typename T>
concept BoundsProvider = requires(T& key_provider) {
{ key_provider.Bounds() } -> std::same_as<YbctidBounds>;
}; // NOLINT
};

template <typename T>
YbctidBounds Bounds(const T& key_provider) {
Expand Down
2 changes: 1 addition & 1 deletion src/yb/rpc/thread_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ThreadPoolTask {
template <typename T>
concept ThreadPoolTaskOrSubclass = requires (T* t) {
std::is_base_of_v<ThreadPoolTask, T>;
}; // NOLINT
};

template <class F, ThreadPoolTaskOrSubclass Base>
class FunctorThreadPoolTask : public Base {
Expand Down
2 changes: 1 addition & 1 deletion src/yb/tserver/pg_client_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ class PgClientSession {
template <class Pb>
concept PbWith_AshMetadataPB = requires (const Pb& t) {
t.ash_metadata();
}; // NOLINT
};

template <PbWith_AshMetadataPB Pb>
void TryUpdateAshWaitState(const Pb& req) {
Expand Down
2 changes: 1 addition & 1 deletion src/yb/util/pb_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ namespace yb {

namespace pb_util_internal {
template <class T>
concept TypeWithEmpty = requires(const T& t) { empty(t); }; // NOLINT
concept TypeWithEmpty = requires(const T& t) { empty(t); };

template <class T>
concept TypeWithoutEmpty = !TypeWithEmpty<T>; // NOLINT
Expand Down
2 changes: 1 addition & 1 deletion src/yb/util/thread_holder.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class ThreadHolder {
template<typename Functor, typename IntegralCounter>
concept StatusFunctorTypeAcceptingIntegral = requires(Functor f, IntegralCounter i) {
{ f(i) } -> std::same_as<Status>;
}; // NOLINT
};

// Processes a collection of items in multiple threads. The nature of items does not matter. The
// processing function only receives an index index of an item. If processing of any item fails, all
Expand Down
10 changes: 5 additions & 5 deletions src/yb/util/tostring.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ namespace yb_tostring {
template <class T>
concept TypeSupportsOutputToStream = requires (const T& t) {
(*static_cast<std::ostream*>(nullptr)) << t;
}; // NOLINT
};

template <class T>
concept TypeWithFree_to_string = requires (const T& t) {
to_string(t);
}; // NOLINT
};

} // namespace yb_tostring

Expand All @@ -63,12 +63,12 @@ namespace yb {
template <class T>
concept TypeWith_ToString = requires (const T& t) {
t.ToString();
}; // NOLINT
};

template <class T>
concept TypeWith_to_string = requires (const T& t) {
t.to_string();
}; // NOLINT
};

template <TypeWith_ToString T>
decltype(auto) ToString(const T& value) {
Expand All @@ -84,7 +84,7 @@ decltype(auto) ToString(const T& value) {
template <class T>
concept TypeWith_ShortDebugString = requires (const T& t) {
t.ShortDebugString();
}; // NOLINT
};

template <TypeWith_ShortDebugString T>
decltype(auto) ToString(const T& value) {
Expand Down
2 changes: 1 addition & 1 deletion src/yb/util/type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ concept TupleLikeType =
typename std::tuple_size<T>::type;
typename std::tuple_element_t<0, T>;
std::get<0>(a);
}; // NOLINT
};

template<typename T>
concept NonReferenceType = !std::is_reference_v<T>;
Expand Down

0 comments on commit 9592939

Please sign in to comment.