[NFC] Remove redundant string copy

This commit is contained in:
Nathan James 2021-04-12 15:13:59 +01:00
parent 58f3201a20
commit bcbea2ab84
No known key found for this signature in database
GPG Key ID: CC007AFCDA90AA5F
1 changed files with 4 additions and 6 deletions

View File

@ -69,10 +69,8 @@ public:
return;
}
// We need to capture an owning-string in the lambda because the lambda
// is invoked in a deferred manner.
std::string LabelStr(Label);
auto DumpWithIndent = [this, DoAddChild, LabelStr](bool IsLastChild) {
auto DumpWithIndent = [this, DoAddChild,
Label(Label.str())](bool IsLastChild) {
// Print out the appropriate tree structure and work out the prefix for
// children of this node. For instance:
//
@ -89,8 +87,8 @@ public:
OS << '\n';
ColorScope Color(OS, ShowColors, IndentColor);
OS << Prefix << (IsLastChild ? '`' : '|') << '-';
if (!LabelStr.empty())
OS << LabelStr << ": ";
if (!Label.empty())
OS << Label << ": ";
this->Prefix.push_back(IsLastChild ? ' ' : '|');
this->Prefix.push_back(' ');