Commit 116d93db authored by Michael Lee's avatar Michael Lee Committed by facebook-github-bot-0

fix -Wshadowing in String.cpp

Summary: Didn't check this with -Wshadow when I first wrote it.

Reviewed By: ranjeeth

Differential Revision: D2926047

fb-gh-sync-id: 8391986dee2d6b5698491bd2995f039468ec684d
shipit-source-id: 8391986dee2d6b5698491bd2995f039468ec684d
parent 2509b98d
......@@ -571,7 +571,7 @@ std::string stripLeftMargin(std::string s) {
const auto sentinel = std::numeric_limits<size_t>::max();
auto indent = sentinel;
size_t max_length = 0;
for (auto piece = piecer.begin(); piece != piecer.end(); piece++) {
for (piece = piecer.begin(); piece != piecer.end(); piece++) {
needle = std::find_if(piece->begin(),
piece->end(),
[](char c) { return c != ' ' && c != '\t'; });
......@@ -582,11 +582,11 @@ std::string stripLeftMargin(std::string s) {
}
}
indent = indent == sentinel ? max_length : indent;
for (auto& piece : piecer) {
if (piece.size() < indent) {
piece.clear();
for (piece = piecer.begin(); piece != piecer.end(); piece++) {
if (piece->size() < indent) {
piece->clear();
} else {
piece.erase(piece.begin(), piece.begin() + indent);
piece->erase(piece->begin(), piece->begin() + indent);
}
}
return join("\n", piecer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment