Browse Source

any: avoid else after return

Michele Caini 1 year ago
parent
commit
cc79817af3
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/entt/core/any.hpp

+ 4 - 4
src/entt/core/any.hpp

@@ -341,9 +341,9 @@ public:
         if(vtable && mode != any_policy::cref && *info == *other.info) {
         if(vtable && mode != any_policy::cref && *info == *other.info) {
             if(auto *val = other.data(); val) {
             if(auto *val = other.data(); val) {
                 return (vtable(operation::transfer, *this, val) != nullptr);
                 return (vtable(operation::transfer, *this, val) != nullptr);
-            } else {
-                return (vtable(operation::assign, *this, std::as_const(other).data()) != nullptr);
             }
             }
+
+            return (vtable(operation::assign, *this, std::as_const(other).data()) != nullptr);
         }
         }
 
 
         return false;
         return false;
@@ -453,9 +453,9 @@ template<typename Type, std::size_t Len, std::size_t Align>
     if constexpr(std::is_copy_constructible_v<std::remove_cv_t<std::remove_reference_t<Type>>>) {
     if constexpr(std::is_copy_constructible_v<std::remove_cv_t<std::remove_reference_t<Type>>>) {
         if(auto *const instance = any_cast<std::remove_reference_t<Type>>(&data); instance) {
         if(auto *const instance = any_cast<std::remove_reference_t<Type>>(&data); instance) {
             return static_cast<Type>(std::move(*instance));
             return static_cast<Type>(std::move(*instance));
-        } else {
-            return any_cast<Type>(data);
         }
         }
+
+        return any_cast<Type>(data);
     } else {
     } else {
         auto *const instance = any_cast<std::remove_reference_t<Type>>(&data);
         auto *const instance = any_cast<std::remove_reference_t<Type>>(&data);
         ENTT_ASSERT(instance, "Invalid instance");
         ENTT_ASSERT(instance, "Invalid instance");