diff options
author | Florian Friesdorf <florian@ternaris.com> | 2022-12-09 17:36:25 +0000 |
---|---|---|
committer | Florian Friesdorf <florian@ternaris.com> | 2022-12-12 18:41:00 +0000 |
commit | 8618c6cc75e19ed658649bd806b218de954ea3bc (patch) | |
tree | 9665c2ae40669cb58263ca4d8be90e5605e47263 /src/libutil/error.cc | |
parent | 7b122d43a49a3bf05436cb2c9b23934ff4bcba2c (diff) |
Simplify loop, feedback from @tfc and @Ericson2314
Diffstat (limited to 'src/libutil/error.cc')
-rw-r--r-- | src/libutil/error.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libutil/error.cc b/src/libutil/error.cc index 449baaad1..3bb3efb0e 100644 --- a/src/libutil/error.cc +++ b/src/libutil/error.cc @@ -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); |