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:
parent
00fe4c7bcb
commit
fa625a2690
Notes:
sideshowbarker
2024-07-19 04:16:41 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/fa625a26908 Pull-request: https://github.com/SerenityOS/serenity/pull/3012
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue