diff --git a/AK/NonnullOwnPtr.h b/AK/NonnullOwnPtr.h index 1645a0009db..8121467e5b8 100644 --- a/AK/NonnullOwnPtr.h +++ b/AK/NonnullOwnPtr.h @@ -25,7 +25,7 @@ template class WeakPtr; template -class NonnullOwnPtr { +class [[nodiscard]] NonnullOwnPtr { public: using ElementType = T; diff --git a/AK/NonnullRefPtr.h b/AK/NonnullRefPtr.h index 7f9a0d00c2b..4640518c2a9 100644 --- a/AK/NonnullRefPtr.h +++ b/AK/NonnullRefPtr.h @@ -39,7 +39,7 @@ ALWAYS_INLINE void unref_if_not_null(T* ptr) } template -class NonnullRefPtr { +class [[nodiscard]] NonnullRefPtr { template friend class RefPtr; template @@ -218,8 +218,11 @@ public: AK::swap(m_ptr, other.m_ptr); } + // clang-format off private: NonnullRefPtr() = delete; + // clang-format on + ALWAYS_INLINE RETURNS_NONNULL T* as_nonnull_ptr() const { VERIFY(m_ptr); diff --git a/AK/OwnPtr.h b/AK/OwnPtr.h index b950076efc0..fe1494bf8d4 100644 --- a/AK/OwnPtr.h +++ b/AK/OwnPtr.h @@ -15,7 +15,7 @@ namespace AK { template -class OwnPtr { +class [[nodiscard]] OwnPtr { public: OwnPtr() = default; diff --git a/AK/RefPtr.h b/AK/RefPtr.h index 41fe032d2b4..5d3acff198f 100644 --- a/AK/RefPtr.h +++ b/AK/RefPtr.h @@ -27,7 +27,7 @@ template class OwnPtr; template -class RefPtr { +class [[nodiscard]] RefPtr { template friend class RefPtr; template diff --git a/AK/WeakPtr.h b/AK/WeakPtr.h index 69c36d24280..f31004f7cde 100644 --- a/AK/WeakPtr.h +++ b/AK/WeakPtr.h @@ -15,7 +15,7 @@ namespace AK { template -class WeakPtr { +class [[nodiscard]] WeakPtr { template friend class Weakable;