Skip to content

Commit 273bbe9

Browse files
committed
Remove FormatForEnv() calls, instead using the ostream formatter
Generated with ``` $ sed -i 's/\.FormatForEnv()//' $(find host common -type f) $ git add . $ git-clang-format ``` Bug: b/471297333
1 parent 0a98ca0 commit 273bbe9

File tree

79 files changed

+142
-166
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+142
-166
lines changed

base/cvd/cuttlefish/common/frontend/socket_vsock_proxy/socket_vsock_proxy.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static Result<void> ListenEventsAndProxy(int events_fd,
185185
// recoverable.
186186
if (!received_event.ok()) {
187187
LOG(ERROR) << "Failed reading kernel log event: "
188-
<< received_event.error().FormatForEnv();
188+
<< received_event.error();
189189
continue;
190190
}
191191
if (!(*received_event)) {
@@ -248,7 +248,7 @@ int main(int argc, char* argv[]) {
248248

249249
auto result = cuttlefish::socket_proxy::Main();
250250
if (!result.ok()) {
251-
LOG(FATAL) << "Failed to proxy: " << result.error().FormatForEnv();
251+
LOG(FATAL) << "Failed to proxy: " << result.error();
252252
}
253253

254254
return 0;

base/cvd/cuttlefish/common/libs/utils/archive.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ std::string ExtractArchiveToMemory(const std::string& archive_filepath,
141141

142142
if (!stdout_str.ok()) {
143143
LOG(ERROR) << "Could not extract \"" << archive_member << "\" from \""
144-
<< archive_filepath
145-
<< "\" to memory: " << stdout_str.error().FormatForEnv();
144+
<< archive_filepath << "\" to memory: " << stdout_str.error();
146145
return "";
147146
}
148147
return *stdout_str;
@@ -159,7 +158,7 @@ std::vector<std::string> ArchiveContents(const std::string& archive) {
159158
return android::base::Split(*bsdtar_output, "\n");
160159
} else {
161160
LOG(ERROR) << "`bsdtar -tf '" << archive
162-
<< "'`failed: " << bsdtar_output.error().FormatForEnv();
161+
<< "'`failed: " << bsdtar_output.error();
163162
return {};
164163
}
165164
}

base/cvd/cuttlefish/common/libs/utils/files_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class FilesTests : public ::testing::Test {
5353
void SetUp() override {
5454
Result<void> result = CreateTestDirs();
5555
if (!result.ok()) {
56-
FAIL() << result.error().FormatForEnv();
56+
FAIL() << result.error();
5757
}
5858
}
5959

base/cvd/cuttlefish/common/libs/utils/subprocess.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ Subprocess Command::Start(SubprocessOptions options) const {
421421

422422
if (!prerequisiteResult.ok()) {
423423
LOG(ERROR) << "Failed to check prerequisites: "
424-
<< prerequisiteResult.error().FormatForEnv();
424+
<< prerequisiteResult.error();
425425
return Subprocess(-1, {});
426426
}
427427
}

base/cvd/cuttlefish/host/commands/assemble_cvd/assemble_cvd.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,6 @@ int main(int argc, char** argv) {
674674
if (res.ok()) {
675675
return *res;
676676
}
677-
LOG(ERROR) << "assemble_cvd failed: \n" << res.error().FormatForEnv();
677+
LOG(ERROR) << "assemble_cvd failed: \n" << res.error();
678678
abort();
679679
}

base/cvd/cuttlefish/host/commands/assemble_cvd/boot_config.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ Result<void> PrepareBootEnvImage(
198198
"Unable to delete the old env image");
199199
LOG(DEBUG) << "Updated bootloader environment image.";
200200
} else if (Result<void> rs = RemoveFile(tmp_boot_env_image_path); !rs.ok()) {
201-
LOG(WARNING) << rs.error().FormatForEnv();
201+
LOG(WARNING) << rs.error();
202202
}
203203

204204
return {};

base/cvd/cuttlefish/host/commands/assemble_cvd/boot_image_utils.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ bool DeleteTmpFileIfNotChanged(const std::string& tmp_file, const std::string& c
104104
} else {
105105
LOG(DEBUG) << "Didn't update " << current_file;
106106
if (Result<void> res = RemoveFile(tmp_file); !res.ok()) {
107-
LOG(ERROR) << res.error().FormatForEnv();
107+
LOG(ERROR) << res.error();
108108
}
109109
}
110110

@@ -176,7 +176,7 @@ void UnpackRamdisk(const std::string& original_ramdisk_path,
176176
<< original_ramdisk_path << "'.";
177177
}
178178
const auto ret = EnsureDirectoryExists(ramdisk_stage_dir);
179-
CHECK(ret.ok()) << ret.error().FormatForEnv();
179+
CHECK(ret.ok()) << ret.error();
180180

181181
SharedFD input = SharedFD::Open(original_ramdisk_path + kCpioExt, O_RDONLY);
182182
int cpio_status;
@@ -245,7 +245,7 @@ bool UnpackVendorBootImageIfNotUnpacked(
245245

246246
Result<std::vector<std::string>> unpack_files = DirectoryContents(unpack_dir);
247247
if (!unpack_files.ok()) {
248-
LOG(ERROR) << "No unpacked files: " << unpack_files.error().FormatForEnv();
248+
LOG(ERROR) << "No unpacked files: " << unpack_files.error();
249249
return false;
250250
}
251251
for (const std::string& unpacked : *unpack_files) {

base/cvd/cuttlefish/host/commands/assemble_cvd/clean.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Result<void> CleanPriorFiles(const std::vector<std::string>& paths,
122122
"Instance directory files in use. Try `cvd reset`? Observed PIDs: {}",
123123
fmt::join(pids, ", "));
124124
} else {
125-
LOG(ERROR) << "Failed to run `lsof`: " << lsof_out.error().FormatForEnv();
125+
LOG(ERROR) << "Failed to run `lsof`: " << lsof_out.error();
126126
}
127127
}
128128

base/cvd/cuttlefish/host/commands/assemble_cvd/create_dynamic_disk_files.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Result<void> CreateDynamicDiskFiles(
109109
LOG(DEBUG) << "Found image zip: " << *img_zip;
110110
} else {
111111
LOG(DEBUG) << "Error accessing '-img-*.zip', expected for a local build.";
112-
LOG(DEBUG) << img_zip.error().FormatForEnv();
112+
LOG(DEBUG) << img_zip.error();
113113
}
114114

115115
std::optional<ChromeOsStateImage> chrome_os_state =

base/cvd/cuttlefish/host/commands/assemble_cvd/graphics_flags.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ GetGraphicsAvailabilityWithSubprocessCheck() {
535535
if (!graphics_detector_stdout.ok()) {
536536
LOG(ERROR)
537537
<< "Failed to run graphics detector, assuming no availability: \n"
538-
<< graphics_detector_stdout.error().FormatForEnv();
538+
<< graphics_detector_stdout.error();
539539
return {};
540540
}
541541
LOG(DEBUG) << *graphics_detector_stdout;
@@ -545,7 +545,7 @@ GetGraphicsAvailabilityWithSubprocessCheck() {
545545
if (!graphics_availability_content_result.ok()) {
546546
LOG(ERROR) << "Failed to read graphics availability from file "
547547
<< graphics_availability_file.path << ":"
548-
<< graphics_availability_content_result.error().FormatForEnv()
548+
<< graphics_availability_content_result.error()
549549
<< ". Assuming no availability.";
550550
return {};
551551
}

0 commit comments

Comments
 (0)