Skip to content

Commit 80b5901

Browse files
committed
Set AllowShortLoopsOnASingleLine to false
1 parent d86e7f0 commit 80b5901

File tree

5 files changed

+23
-10
lines changed

5 files changed

+23
-10
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ AllowShortBlocksOnASingleLine: true
1515
AllowShortCaseLabelsOnASingleLine: true
1616
AllowShortFunctionsOnASingleLine: All
1717
AllowShortIfStatementsOnASingleLine: true
18-
AllowShortLoopsOnASingleLine: true
18+
AllowShortLoopsOnASingleLine: false
1919
# This is deprecated
2020
AlwaysBreakAfterDefinitionReturnType: All
2121
AlwaysBreakAfterReturnType: None

benchmarks/random_allocations/random_allocations.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,8 @@ BM_RandomAllocations(benchmark::State& state) {
232232
size_t max_size = state.range(1);
233233

234234
try {
235-
for (auto _ : state) uniform_random_allocations(*mr, num_allocations, max_size, max_usage);
235+
for (auto _ : state)
236+
uniform_random_allocations(*mr, num_allocations, max_size, max_usage);
236237
} catch (std::exception const& e) { std::cout << "Error: " << e.what() << "\n"; }
237238
}
238239

@@ -250,7 +251,8 @@ size_range(benchmark::internal::Benchmark* b, int num) {
250251

251252
static void
252253
num_size_range(benchmark::internal::Benchmark* b) {
253-
for (int num_allocations : std::vector<int>{1000, 10000, 100000}) size_range(b, num_allocations);
254+
for (int num_allocations : std::vector<int>{1000, 10000, 100000})
255+
size_range(b, num_allocations);
254256
}
255257

256258
int num_allocations = -1;

benchmarks/replay/cxxopts.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ stringAppend(String& s, String a) {
114114

115115
inline String&
116116
stringAppend(String& s, int n, UChar32 c) {
117-
for (int i = 0; i != n; ++i) { s.append(c); }
117+
for (int i = 0; i != n; ++i) {
118+
s.append(c);
119+
}
118120

119121
return s;
120122
}
@@ -1556,7 +1558,9 @@ Options::generate_all_groups_help(String& result) const {
15561558
std::vector<std::string> all_groups;
15571559
all_groups.reserve(m_help.size());
15581560

1559-
for (auto& group : m_help) { all_groups.push_back(group.first); }
1561+
for (auto& group : m_help) {
1562+
all_groups.push_back(group.first);
1563+
}
15601564

15611565
generate_group_help(result, all_groups);
15621566
}

benchmarks/replay/rapidcsv.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,9 @@ class Document {
10731073
if ((mLabelParams.mRowNameIdx >= 0) &&
10741074
(static_cast<ssize_t>(mData.size()) > (mLabelParams.mColumnNameIdx + 1))) {
10751075
int i = 0;
1076-
for (auto& dataRow : mData) { mRowNames[dataRow[mLabelParams.mRowNameIdx]] = i++; }
1076+
for (auto& dataRow : mData) {
1077+
mRowNames[dataRow[mLabelParams.mRowNameIdx]] = i++;
1078+
}
10771079
}
10781080
}
10791081

benchmarks/test/test_benchmark.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
static void
44
BM_StringCreation(benchmark::State& state) {
5-
for (auto _ : state) std::string empty_string;
5+
for (auto _ : state)
6+
std::string empty_string;
67
}
78
// Register the function as a benchmark
89
BENCHMARK(BM_StringCreation);
@@ -11,15 +12,18 @@ BENCHMARK(BM_StringCreation);
1112
static void
1213
BM_StringCopy(benchmark::State& state) {
1314
std::string x = "hello";
14-
for (auto _ : state) std::string copy(x);
15+
for (auto _ : state)
16+
std::string copy(x);
1517
}
1618
BENCHMARK(BM_StringCopy);
1719

1820
static void
1921
BM_StringCompare(benchmark::State& state) {
2022
std::string s1(state.range(0), '-');
2123
std::string s2(state.range(0), '-');
22-
for (auto _ : state) { benchmark::DoNotOptimize(s1.compare(s2)); }
24+
for (auto _ : state) {
25+
benchmark::DoNotOptimize(s1.compare(s2));
26+
}
2327
state.SetComplexityN(state.range(0));
2428
}
2529
BENCHMARK(BM_StringCompare)->RangeMultiplier(2)->Range(1 << 10, 1 << 18)->Complexity(benchmark::oN);
@@ -30,7 +34,8 @@ BM_Sequential(benchmark::State& state) {
3034
Q q;
3135
typename Q::value_type v(0);
3236
for (auto _ : state) {
33-
for (int i = state.range(0); i--;) q.push_back(v);
37+
for (int i = state.range(0); i--;)
38+
q.push_back(v);
3439
}
3540
// actually messages, not bytes:
3641
state.SetBytesProcessed(static_cast<int64_t>(state.iterations()) * state.range(0));

0 commit comments

Comments
 (0)