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]].
This commit is contained in:
Brian Gianforcaro 2020-08-05 06:40:03 -07:00 committed by Andreas Kling
parent 00fe4c7bcb
commit fa625a2690

View file

@ -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;