Skip to content

Commit

Permalink
Simplify loop, feedback from @tfc and @Ericson2314
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoflow committed Dec 12, 2022
1 parent 7679d1b commit 46a211b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libutil/error.cc
Expand Up @@ -265,11 +265,11 @@ std::ostream & showErrorInfo(std::ostream & out, const ErrorInfo & einfo, bool s

// traces
if (showTrace && !einfo.traces.empty()) {
for (auto iter = einfo.traces.begin(); iter != einfo.traces.end(); ++iter) {
oss << "\n" << "" << iter->hint.str() << "\n";
for (const auto & trace : einfo.traces) {
oss << "\n" << "" << trace.hint.str() << "\n";

if (iter->pos.has_value() && (*iter->pos)) {
auto pos = iter->pos.value();
if (trace.pos.has_value() && (*trace.pos)) {
auto pos = trace.pos.value();
oss << "\n";
printAtPos(pos, oss);

Expand Down

0 comments on commit 46a211b

Please sign in to comment.