From 78e410dc1a5ae854a0daa9a3db9af96995998213 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Wed, 23 Oct 2024 08:36:11 +0200 Subject: [PATCH] resource: [[nodiscard]] --- src/uvw/resource.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uvw/resource.hpp b/src/uvw/resource.hpp index 07b929f4..02e3ef75 100644 --- a/src/uvw/resource.hpp +++ b/src/uvw/resource.hpp @@ -17,7 +17,7 @@ namespace uvw { template class resource: public uv_type, public emitter, public std::enable_shared_from_this { protected: - int leak_if(int err) noexcept { + [[nodiscard]] int leak_if(int err) noexcept { if(err == 0) { self_ptr = this->shared_from_this(); } @@ -29,7 +29,7 @@ protected: self_ptr.reset(); } - bool has_self() const noexcept { + [[nodiscard]] bool has_self() const noexcept { return static_cast(self_ptr); } @@ -44,7 +44,7 @@ public: * @return User-defined data if any, an invalid pointer otherwise. */ template - std::shared_ptr data() const { + [[nodiscard]] std::shared_ptr data() const { return std::static_pointer_cast(user_data); }