Convert system/core to Result::ok()
No functionality changes, this is a mechanical cleanup.
Test: m
Test: cd system/core && atest
Change-Id: Ifdaa3ce1947ed578f656d5a446978726eb416c36
diff --git a/init/action.cpp b/init/action.cpp
index f05fa7c..1e998ae 100644
--- a/init/action.cpp
+++ b/init/action.cpp
@@ -36,7 +36,7 @@
builtin_arguments.args[0] = args[0];
for (std::size_t i = 1; i < args.size(); ++i) {
auto expanded_arg = ExpandProps(args[i]);
- if (!expanded_arg) {
+ if (!expanded_arg.ok()) {
return expanded_arg.error();
}
builtin_arguments.args[i] = std::move(*expanded_arg);
@@ -59,7 +59,7 @@
}
auto expanded_args = subcontext->ExpandArgs(args_);
- if (!expanded_args) {
+ if (!expanded_args.ok()) {
return expanded_args.error();
}
return RunBuiltinFunction(func_, *expanded_args, subcontext->context());
@@ -75,7 +75,7 @@
builtin_arguments.args[0] = args_[0];
for (size_t i = 1; i < args_.size(); ++i) {
auto expanded_arg = ExpandProps(args_[i]);
- if (!expanded_arg) {
+ if (!expanded_arg.ok()) {
if (expanded_arg.error().message().find("doesn't exist while expanding") !=
std::string::npos) {
// If we failed because we won't have a property, use an empty string, which is
@@ -114,7 +114,7 @@
}
auto map_result = function_map_->Find(args);
- if (!map_result) {
+ if (!map_result.ok()) {
return Error() << map_result.error();
}
@@ -134,7 +134,7 @@
size_t Action::CheckAllCommands() const {
size_t failures = 0;
for (const auto& command : commands_) {
- if (auto result = command.CheckCommand(); !result) {
+ if (auto result = command.CheckCommand(); !result.ok()) {
LOG(ERROR) << "Command '" << command.BuildCommandString() << "' (" << filename_ << ":"
<< command.line() << ") failed: " << result.error();
++failures;
@@ -169,7 +169,7 @@
LOG(INFO) << "Command '" << cmd_str << "' action=" << trigger_name << " (" << filename_
<< ":" << command.line() << ") took " << duration.count() << "ms and "
- << (result ? "succeeded" : "failed: " + result.error().message());
+ << (result.ok() ? "succeeded" : "failed: " + result.error().message());
}
}