init: add [[nodiscard]] to Result
It's better to either check these results or explicitly ignore them.
Only a few callers weren't already doing this, so it's relatively
trivial to enforce.
Test: build
Change-Id: I44cdc342e46128f66cac914aaa0b9b4559cacd8c
diff --git a/init/result.h b/init/result.h
index fc03962..0e3fd3d 100644
--- a/init/result.h
+++ b/init/result.h
@@ -151,7 +151,7 @@
}
template <typename T>
-class Result {
+class [[nodiscard]] Result {
public:
Result() {}
@@ -170,6 +170,8 @@
: contents_(std::in_place_index_t<1>(), std::move(result_error.error_string),
result_error.error_errno) {}
+ void IgnoreError() const {}
+
bool has_value() const { return contents_.index() == 0; }
T& value() & { return std::get<0>(contents_); }