clang-tidy: use for range loops

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2021-08-17 15:41:44 -07:00 committed by Johannes Altmanninger
parent dffc84712a
commit faf51e0693
2 changed files with 10 additions and 10 deletions

View File

@ -739,8 +739,8 @@ static expand_result_t expand_cmdsubst(wcstring input, const operation_context_t
}
wcstring sub_res_joined;
sub_res_joined.reserve(approx_size);
for (size_t i = 0; i < sub_res.size(); i++) {
sub_res_joined.append(escape_string_for_double_quotes(std::move(sub_res.at(i))));
for (const wcstring &line : sub_res) {
sub_res_joined.append(escape_string_for_double_quotes(std::move(line)));
sub_res_joined.push_back(L'\n');
}
// Mimic POSIX shells by stripping all trailing newlines.

View File

@ -4089,13 +4089,13 @@ static void test_notifiers_with_strategy(universal_notifier_t::notifier_strategy
std::unique_ptr<universal_notifier_t> notifiers[notifier_count];
// Populate array of notifiers.
for (size_t i = 0; i < notifier_count; i++) {
notifiers[i] = universal_notifier_t::new_notifier_for_strategy(strategy, UVARS_TEST_PATH);
for (auto &notifier : notifiers) {
notifier = universal_notifier_t::new_notifier_for_strategy(strategy, UVARS_TEST_PATH);
}
// Nobody should poll yet.
for (size_t i = 0; i < notifier_count; i++) {
if (poll_notifier(notifiers[i])) {
for (const auto &notifier : notifiers) {
if (poll_notifier(notifier)) {
err(L"Universal variable notifier polled true before any changes, with strategy %d",
(int)strategy);
}
@ -4139,15 +4139,15 @@ static void test_notifiers_with_strategy(universal_notifier_t::notifier_strategy
// Have to clean up the posted one first, so that the others see the pipe become no
// longer readable.
poll_notifier(notifiers[post_idx]);
for (size_t i = 0; i < notifier_count; i++) {
poll_notifier(notifiers[i]);
for (const auto &notifier : notifiers) {
poll_notifier(notifier);
}
}
}
// Nobody should poll now.
for (size_t i = 0; i < notifier_count; i++) {
if (poll_notifier(notifiers[i])) {
for (const auto &notifier : notifiers) {
if (poll_notifier(notifier)) {
err(L"Universal variable notifier polled true after all changes, with strategy %d",
(int)strategy);
}