mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 19:50:14 +01:00
Avoid using string operator += for a single character (#7747)
This is flagged as a mistake by clang-tidy 24. String's operator `+=` is pretty bad in general, this moves a few uses to push_back.
This commit is contained in:
@@ -150,12 +150,12 @@ class StringFingerprintStore {
|
||||
bool first = true;
|
||||
for (const auto& item : contents_) {
|
||||
if (!first) {
|
||||
result += ",";
|
||||
result.push_back(',');
|
||||
}
|
||||
first = false;
|
||||
result += item;
|
||||
}
|
||||
result += "}";
|
||||
result.push_back('}');
|
||||
return SaveString(std::move(result));
|
||||
}
|
||||
|
||||
|
||||
@@ -409,7 +409,7 @@ auto InstNamer::Namespace::AllocateName(
|
||||
}
|
||||
|
||||
// Append numbers until we find an available name.
|
||||
name += ".";
|
||||
name.push_back('.');
|
||||
auto name_size_without_counter = name.size();
|
||||
for (int counter = 1;; ++counter) {
|
||||
name.resize(name_size_without_counter);
|
||||
|
||||
Reference in New Issue
Block a user