PragmaTwice commented on code in PR #1032:
URL: 
https://github.com/apache/incubator-kvrocks/pull/1032#discussion_r1004434705


##########
src/common/status.h:
##########
@@ -285,3 +282,10 @@ struct StatusOr {
   template <typename>
   friend struct StatusOr;
 };
+
+#define GET_OR_RET(...)                                         \
+  ({                                                            \
+    auto&& status = (__VA_ARGS__);                              \
+    if (!status) return std::forward<decltype(status)>(status); \
+    std::forward<decltype(status)>(status);                     \
+  }).GetValue()

Review Comment:
   I think `unwrap` in rust means that, if it has a value, return it, otherwise 
just abort. But here we will not abort the program, just return the error 
status to the upper layer. So I think it is not appropriate.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to