diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-09-15 23:20:31 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-16 17:17:13 +0200 |
commit | c192c303d22a0b4ad698f5ad032527e3f86fbbbf (patch) | |
tree | 69df9fd871c4e56e0ed0d51ccb98490510267533 /AK | |
parent | 9fe43041f562d3ee8bfb46063071201158325738 (diff) | |
download | serenity-c192c303d22a0b4ad698f5ad032527e3f86fbbbf.zip |
AK: Use default constructor/destructor instead of declaring an empty one
Default implementations allow for more optimizations.
See: https://pvs-studio.com/en/docs/warnings/v832/
Diffstat (limited to 'AK')
-rw-r--r-- | AK/CircularQueue.h | 4 | ||||
-rw-r--r-- | AK/DistinctNumeric.h | 4 | ||||
-rw-r--r-- | AK/FixedArray.h | 2 | ||||
-rw-r--r-- | AK/NonnullPtrVector.h | 4 | ||||
-rw-r--r-- | AK/RedBlackTree.h | 2 | ||||
-rw-r--r-- | AK/UUID.cpp | 3 | ||||
-rw-r--r-- | AK/UUID.h | 2 | ||||
-rw-r--r-- | AK/Variant.h | 2 |
8 files changed, 7 insertions, 16 deletions
diff --git a/AK/CircularQueue.h b/AK/CircularQueue.h index e0a68c8785..e7ec5463b2 100644 --- a/AK/CircularQueue.h +++ b/AK/CircularQueue.h @@ -17,9 +17,7 @@ class CircularQueue { friend CircularDuplexStream<Capacity>; public: - CircularQueue() - { - } + CircularQueue() = default; ~CircularQueue() { diff --git a/AK/DistinctNumeric.h b/AK/DistinctNumeric.h index f6c2c67dbe..8a5321143a 100644 --- a/AK/DistinctNumeric.h +++ b/AK/DistinctNumeric.h @@ -52,9 +52,7 @@ class DistinctNumeric { using Self = DistinctNumeric<T, X, Incr, Cmp, Bool, Flags, Shift, Arith>; public: - constexpr DistinctNumeric() - { - } + constexpr DistinctNumeric() = default; constexpr DistinctNumeric(T value) : m_value { value } diff --git a/AK/FixedArray.h b/AK/FixedArray.h index c2d22512ca..d2a631fdd0 100644 --- a/AK/FixedArray.h +++ b/AK/FixedArray.h @@ -15,7 +15,7 @@ namespace AK { template<typename T> class FixedArray { public: - FixedArray() { } + FixedArray() = default; explicit FixedArray(size_t size) : m_size(size) { diff --git a/AK/NonnullPtrVector.h b/AK/NonnullPtrVector.h index 5917dbd940..3725019115 100644 --- a/AK/NonnullPtrVector.h +++ b/AK/NonnullPtrVector.h @@ -16,9 +16,7 @@ class NonnullPtrVector : public Vector<PtrType, inline_capacity> { using Base = Vector<PtrType, inline_capacity>; public: - NonnullPtrVector() - { - } + NonnullPtrVector() = default; NonnullPtrVector(Vector<PtrType>&& other) : Base(static_cast<Base&&>(other)) diff --git a/AK/RedBlackTree.h b/AK/RedBlackTree.h index b9ae98adfe..d81a14993a 100644 --- a/AK/RedBlackTree.h +++ b/AK/RedBlackTree.h @@ -46,7 +46,7 @@ public: protected: BaseRedBlackTree() = default; // These are protected to ensure no one instantiates the leaky base red black tree directly - virtual ~BaseRedBlackTree() {}; + virtual ~BaseRedBlackTree() = default; void rotate_left(Node* subtree_root) { diff --git a/AK/UUID.cpp b/AK/UUID.cpp index 1234c29ad3..cc87d7adca 100644 --- a/AK/UUID.cpp +++ b/AK/UUID.cpp @@ -10,9 +10,6 @@ #include <AK/UUID.h> namespace AK { -UUID::UUID() -{ -} UUID::UUID(Array<u8, 16> uuid_buffer) { @@ -15,7 +15,7 @@ namespace AK { class UUID { public: - UUID(); + UUID() = default; UUID(Array<u8, 16> uuid_buffer); UUID(const StringView&); ~UUID() = default; diff --git a/AK/Variant.h b/AK/Variant.h index 287e717323..f757e2a3ac 100644 --- a/AK/Variant.h +++ b/AK/Variant.h @@ -116,7 +116,7 @@ struct VariantConstructors { internal_cast().set(t, VariantNoClearTag {}); } - ALWAYS_INLINE VariantConstructors() { } + ALWAYS_INLINE VariantConstructors() = default; private: [[nodiscard]] ALWAYS_INLINE Base& internal_cast() |