Skip to content

Commit f3775cb

Browse files
mizdebskmkoncek
authored andcommitted
Annotate return values with nodiscard
Add nodiscard to functions returning values that should not be ignored, such as accessors and lock wrappers. This helps prevent subtle bugs by alerting developers when important return values are discarded.
1 parent dbb9e32 commit f3775cb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/java_symbols.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct Path_origin_entry : std::filesystem::path
6868
{
6969
}
7070

71-
std::string_view origin() const noexcept
71+
[[nodiscard]] std::string_view origin() const noexcept
7272
{
7373
return origin_;
7474
}
@@ -100,7 +100,7 @@ struct Mutex
100100
return Locked(value_, mutex_);
101101
}
102102

103-
Locked<const Type, std::mutex> lock() const
103+
[[nodiscard]] Locked<const Type, std::mutex> lock() const
104104
{
105105
return Locked(value_, mutex_);
106106
}

0 commit comments

Comments
 (0)