From fa625a26908262cc3aaeaf407cf735ad1a067da0 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Wed, 5 Aug 2020 06:40:03 -0700 Subject: [PATCH] AK: Decorate AK::OwnPtr::leak_ptr() with [[nodiscard]] We should always leak to an observed variable, otherwise it's an actual leak. This is similar to AK::RefPtr::leak_ref() which is also marked as [[nodiscard]]. --- AK/OwnPtr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AK/OwnPtr.h b/AK/OwnPtr.h index 2ece450e81..6b87526092 100644 --- a/AK/OwnPtr.h +++ b/AK/OwnPtr.h @@ -137,7 +137,7 @@ public: bool operator!() const { return !m_ptr; } - T* leak_ptr() + [[nodiscard]] T* leak_ptr() { T* leaked_ptr = m_ptr; m_ptr = nullptr;