From 8c3ca20d197ada4df28b0c6a5bbb520e54ffb178 Mon Sep 17 00:00:00 2001 From: skypjack Date: Tue, 7 Oct 2025 11:21:45 +0200 Subject: [PATCH] clang-tidy: I do actually prefer else-after-return style --- .clang-tidy | 1 + src/entt/meta/meta.hpp | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 44916b515..f7a0f4ea6 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -18,6 +18,7 @@ Checks: > performance-*, portability-*, readability-*, + -readability-else-after-return, -readability-function-cognitive-complexity, -readability-named-parameter, -readability-uppercase-literal-suffix, diff --git a/src/entt/meta/meta.hpp b/src/entt/meta/meta.hpp index b798bf4e5..a69b69652 100644 --- a/src/entt/meta/meta.hpp +++ b/src/entt/meta/meta.hpp @@ -1555,9 +1555,7 @@ bool meta_any::set(const id_type id, Type &&value) { [[nodiscard]] inline meta_any meta_any::allow_cast(const meta_type &type) const { if(storage.has_value(type.info())) { return as_ref(); - } - - if(resolve != nullptr) { + } else if(resolve != nullptr) { return internal::try_convert(internal::meta_context::from(*ctx), fetch_node(), type.info().hash(), type.is_arithmetic() || type.is_enum(), storage.data(), [this, &type]([[maybe_unused]] const void *instance, [[maybe_unused]] auto &&...args) { if constexpr((std::is_same_v>, internal::meta_type_node> || ...)) { return (args.from_void(*ctx, nullptr, instance), ...); @@ -1582,9 +1580,7 @@ bool meta_any::set(const id_type id, Type &&value) { [[nodiscard]] inline bool meta_any::allow_cast(const meta_type &type) { if(storage.has_value(type.info())) { return true; - } - - if(auto other = std::as_const(*this).allow_cast(type); other) { + } else if(auto other = std::as_const(*this).allow_cast(type); other) { if(other.storage.owner()) { std::swap(*this, other); }