Skip to content

Commit

Permalink
Apply clang-tidy modernize-type-traits
Browse files Browse the repository at this point in the history
Summary: Apply clang-tidy [modernize-type-traits](https://clang.llvm.org/extra/clang-tidy/checks/modernize/type-traits.html) check to `thrift/compiler` and `thrift/lib/cpp2`.

Reviewed By: avalonalex

Differential Revision: D64241270

fbshipit-source-id: 395f77589c451ca8409d1ccda6231bf6e5a81534
  • Loading branch information
yoney authored and facebook-github-bot committed Oct 11, 2024
1 parent c8c356b commit b2d15ef
Show file tree
Hide file tree
Showing 28 changed files with 128 additions and 160 deletions.
2 changes: 1 addition & 1 deletion thrift/compiler/lib/schematizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ template <typename... Args>
std::unique_ptr<t_const_value> val(Args&&... args) {
return std::make_unique<t_const_value>(std::forward<Args>(args)...);
}
template <typename Enm, typename = std::enable_if_t<std::is_enum<Enm>::value>>
template <typename Enm, typename = std::enable_if_t<std::is_enum_v<Enm>>>
std::unique_ptr<t_const_value> val(Enm val) {
return std::make_unique<t_const_value>(
static_cast<std::underlying_type_t<Enm>>(val));
Expand Down
2 changes: 1 addition & 1 deletion thrift/compiler/sema/sema_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class node_metadata_cache {
using element_type = typename decltype(std::declval<F>()())::element_type;
template <typename T, typename... Args>
using if_is_constructible =
std::enable_if_t<std::is_constructible<T, Args...>::value, T&>;
std::enable_if_t<std::is_constructible_v<T, Args...>, T&>;
using key_type = std::pair<const t_node*, std::type_index>;

public:
Expand Down
2 changes: 1 addition & 1 deletion thrift/compiler/test/const_util_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ template <typename... Args>
std::unique_ptr<t_const_value> val(Args&&... args) {
return std::make_unique<t_const_value>(std::forward<Args>(args)...);
}
template <typename Enum, typename = std::enable_if_t<std::is_enum<Enum>::value>>
template <typename Enum, typename = std::enable_if_t<std::is_enum_v<Enum>>>
std::unique_ptr<t_const_value> val(Enum val) {
return std::make_unique<t_const_value>(
static_cast<std::underlying_type_t<Enum>>(val));
Expand Down
4 changes: 2 additions & 2 deletions thrift/lib/cpp2/Adapt.h
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,8 @@ struct adapter_serialized_size<
Adapter,
AdaptedT,
Protocol> &&
std::is_arithmetic<decltype(Adapter::toThrift(
std::declval<AdaptedT&>()))>::value>> {
std::is_arithmetic_v<decltype(Adapter::toThrift(
std::declval<AdaptedT&>()))>>> {
uint32_t operator()(Protocol& prot, const AdaptedT&, FallbackF) {
return serializedSizeFixed(
prot, decltype(Adapter::toThrift(std::declval<AdaptedT&>()))(0));
Expand Down
Loading

0 comments on commit b2d15ef

Please sign in to comment.