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_test.cpp b/init/subcontext_test.cpp
index 2635683..55912d6 100644
--- a/init/subcontext_test.cpp
+++ b/init/subcontext_test.cpp
@@ -175,14 +175,14 @@
TestFunctionMap test_function_map;
// For CheckDifferentPid
test_function_map.Add("return_pids_as_error", 0, 0, true,
- [](const BuiltinArguments& args) -> Result<Success> {
+ [](const BuiltinArguments& args) -> Result<void> {
return Error() << getpid() << " " << getppid();
});
// For SetProp
test_function_map.Add("setprop", 2, 2, true, [](const BuiltinArguments& args) {
android::base::SetProperty(args[1], args[2]);
- return Success();
+ return Result<void>{};
});
// For MultipleCommands
@@ -190,26 +190,26 @@
auto words = std::make_shared<std::vector<std::string>>();
test_function_map.Add("add_word", 1, 1, true, [words](const BuiltinArguments& args) {
words->emplace_back(args[1]);
- return Success();
+ return Result<void>{};
});
test_function_map.Add("return_words_as_error", 0, 0, true,
- [words](const BuiltinArguments& args) -> Result<Success> {
+ [words](const BuiltinArguments& args) -> Result<void> {
return Error() << Join(*words, " ");
});
// For RecoverAfterAbort
test_function_map.Add("cause_log_fatal", 0, 0, true,
- [](const BuiltinArguments& args) -> Result<Success> {
+ [](const BuiltinArguments& args) -> Result<void> {
return Error() << std::string(4097, 'f');
});
test_function_map.Add(
- "generate_sane_error", 0, 0, true,
- [](const BuiltinArguments& args) -> Result<Success> { return Error() << "Sane error!"; });
+ "generate_sane_error", 0, 0, true,
+ [](const BuiltinArguments& args) -> Result<void> { return Error() << "Sane error!"; });
// For ContextString
test_function_map.Add(
- "return_context_as_error", 0, 0, true,
- [](const BuiltinArguments& args) -> Result<Success> { return Error() << args.context; });
+ "return_context_as_error", 0, 0, true,
+ [](const BuiltinArguments& args) -> Result<void> { return Error() << args.context; });
return test_function_map;
}