init: replace Result<Success> with Result<void>
Now that Result<T> is actually expected<T, ...>, and the expected
proposal states expected<void, ...> as the way to indicate an expected
object that returns either successfully with no object or an error,
let's move init's Result<Success> to the preferred Result<void>.
Bug: 132145659
Test: boot, init unit tests
Change-Id: Ib2f98396d8e6e274f95a496fcdfd8341f77585ee
diff --git a/init/subcontext.cpp b/init/subcontext.cpp
index 0ff479a..02ed507 100644
--- a/init/subcontext.cpp
+++ b/init/subcontext.cpp
@@ -72,7 +72,7 @@
}
template <typename T>
-Result<Success> SendMessage(int socket, const T& message) {
+Result<void> SendMessage(int socket, const T& message) {
std::string message_string;
if (!message.SerializeToString(&message_string)) {
return Error() << "Unable to serialize message";
@@ -87,7 +87,7 @@
result != static_cast<long>(message_string.size())) {
return ErrnoError() << "send() failed to send message contents";
}
- return Success();
+ return {};
}
std::vector<std::pair<std::string, std::string>> properties_to_set;
@@ -123,7 +123,7 @@
}
auto map_result = function_map_->FindFunction(args);
- Result<Success> result;
+ Result<void> result;
if (!map_result) {
result = Error() << "Cannot find command: " << map_result.error();
} else {
@@ -299,7 +299,7 @@
return subcontext_reply;
}
-Result<Success> Subcontext::Execute(const std::vector<std::string>& args) {
+Result<void> Subcontext::Execute(const std::vector<std::string>& args) {
auto subcontext_command = SubcontextCommand();
std::copy(
args.begin(), args.end(),
@@ -329,7 +329,7 @@
<< subcontext_reply->reply_case();
}
- return Success();
+ return {};
}
Result<std::vector<std::string>> Subcontext::ExpandArgs(const std::vector<std::string>& args) {