Skip to content

Commit be25679

Browse files
Revert "Fix formatting to pass with checks"
This reverts commit 894f73b.
1 parent f316fb9 commit be25679

File tree

2 files changed

+17
-24
lines changed

2 files changed

+17
-24
lines changed

.clang-format

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,22 @@ BinPackParameters: false
5757
BitFieldColonSpacing: Both
5858
BraceWrapping:
5959
AfterCaseLabel: false
60-
AfterClass: true
60+
AfterClass: false
6161
AfterControlStatement: Never
6262
AfterEnum: false
6363
AfterExternBlock: false
64-
AfterFunction: true
64+
AfterFunction: false
6565
AfterNamespace: false
6666
AfterObjCDeclaration: false
67-
AfterStruct: true
68-
AfterUnion: true
69-
BeforeCatch: true
70-
BeforeElse: true
67+
AfterStruct: false
68+
AfterUnion: false
69+
BeforeCatch: false
70+
BeforeElse: false
7171
BeforeLambdaBody: false
7272
BeforeWhile: false
7373
IndentBraces: false
74-
SplitEmptyFunction: false
75-
SplitEmptyRecord: false
74+
SplitEmptyFunction: true
75+
SplitEmptyRecord: true
7676
SplitEmptyNamespace: true
7777
BreakAfterAttributes: Never
7878
BreakAfterJavaFieldAnnotations: false

examples/scope_example.cpp

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,26 @@
55
#include <iostream>
66
#include <string_view>
77

8-
void print_exit_status(std::string_view name, bool exit_status, bool did_throw)
9-
{
8+
void print_exit_status(std::string_view name, bool exit_status, bool did_throw) {
109
std::cout << name << ":\n";
11-
std::cout << " Exception thrown: " << (did_throw ? "yes" : "no") << "\n";
12-
std::cout << " Exit status: " << (exit_status ? "finished" : "pending") << "\n\n";
10+
std::cout << " Throwed exception " << (did_throw ? "yes" : "no") << "\n";
11+
std::cout << " Exit status " << (exit_status ? "finished" : "pending") << "\n\n";
1312
}
1413

1514
// Randomly throw an exception (50% chance)
16-
void maybe_throw()
17-
{
15+
void maybe_throw() {
1816
if (std::rand() >= RAND_MAX / 2)
1917
throw std::exception{};
2018
}
2119

22-
int main()
23-
{
20+
int main() {
2421
bool exit_status{false}, did_throw{false};
2522

2623
// Manual handling at "end of scope"
2724
try {
2825
maybe_throw();
2926
exit_status = true;
30-
}
31-
catch (...) {
27+
} catch (...) {
3228
did_throw = true;
3329
}
3430
print_exit_status("Manual handling", exit_status, did_throw);
@@ -38,8 +34,7 @@ int main()
3834
try {
3935
auto guard = std::experimental::scope_exit{[&] { exit_status = true; }};
4036
maybe_throw();
41-
}
42-
catch (...) {
37+
} catch (...) {
4338
did_throw = true;
4439
}
4540
print_exit_status("scope_exit", exit_status, did_throw);
@@ -49,8 +44,7 @@ int main()
4944
try {
5045
auto guard = std::experimental::scope_fail{[&] { exit_status = true; }};
5146
maybe_throw();
52-
}
53-
catch (...) {
47+
} catch (...) {
5448
did_throw = true;
5549
}
5650
print_exit_status("scope_fail", exit_status, did_throw);
@@ -60,8 +54,7 @@ int main()
6054
try {
6155
auto guard = std::experimental::scope_success{[&] { exit_status = true; }};
6256
maybe_throw();
63-
}
64-
catch (...) {
57+
} catch (...) {
6558
did_throw = true;
6659
}
6760
print_exit_status("scope_success", exit_status, did_throw);

0 commit comments

Comments
 (0)