AK: Make ScopeGuard and ArmedScopeGuard [[nodiscard]]

Brought to you by a significant amount of pain and suffering, which this
would have prevented.
This commit is contained in:
Sam Atkins 2025-01-09 16:56:40 +00:00 committed by Tim Ledbetter
parent 10766ecf54
commit c86ad5c505
Notes: github-actions[bot] 2025-01-09 18:37:35 +00:00

View file

@ -11,7 +11,7 @@
namespace AK { namespace AK {
template<typename Callback> template<typename Callback>
class ScopeGuard { class [[nodiscard]] ScopeGuard {
public: public:
ScopeGuard(Callback callback) ScopeGuard(Callback callback)
: m_callback(move(callback)) : m_callback(move(callback))
@ -28,7 +28,7 @@ private:
}; };
template<typename Callback> template<typename Callback>
class ArmedScopeGuard { class [[nodiscard]] ArmedScopeGuard {
public: public:
ArmedScopeGuard(Callback callback) ArmedScopeGuard(Callback callback)
: m_callback(move(callback)) : m_callback(move(callback))