Skip to content

Commit a90988b

Browse files
committed
Update the formatting to now allow functions on a single line
This makes it less annoying when the IDE is auto-formatting while you type
1 parent 3a1298f commit a90988b

File tree

5 files changed

+44
-18
lines changed

5 files changed

+44
-18
lines changed

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ AlignTrailingComments: true
1010
AllowAllParametersOfDeclarationOnNextLine: true
1111
AllowShortBlocksOnASingleLine: false
1212
AllowShortCaseLabelsOnASingleLine: false
13-
AllowShortFunctionsOnASingleLine: true
13+
AllowShortFunctionsOnASingleLine: false
1414
AllowShortIfStatementsOnASingleLine: false
1515
AllowShortLoopsOnASingleLine: false
1616
AlwaysBreakAfterDefinitionReturnType: None

src/cmake_generator.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,17 @@ void generate_project(const std::string &type) {
126126

127127
struct CommandEndl {
128128
std::stringstream &ss;
129-
CommandEndl(std::stringstream &ss) : ss(ss) {}
130-
void endl() { ss << '\n'; }
129+
CommandEndl(std::stringstream &ss) : ss(ss) {
130+
}
131+
void endl() {
132+
ss << '\n';
133+
}
131134
};
132135

133136
struct RawArg {
134137
RawArg() = default;
135-
RawArg(std::string arg) : arg(std::move(arg)) {}
138+
RawArg(std::string arg) : arg(std::move(arg)) {
139+
}
136140

137141
std::string arg;
138142
};
@@ -148,7 +152,8 @@ struct Command {
148152
std::string post_comment;
149153

150154
Command(std::stringstream &ss, int depth, std::string command, std::string post_comment)
151-
: ss(ss), depth(depth), command(std::move(command)), post_comment(std::move(post_comment)) {}
155+
: ss(ss), depth(depth), command(std::move(command)), post_comment(std::move(post_comment)) {
156+
}
152157

153158
~Command() noexcept(false) {
154159
if (!generated) {
@@ -317,7 +322,8 @@ static std::string tolf(const std::string &str) {
317322
};
318323

319324
struct Generator {
320-
Generator(const parser::Project &project) : project(project) {}
325+
Generator(const parser::Project &project) : project(project) {
326+
}
321327
Generator(const Generator &) = delete;
322328

323329
const parser::Project &project;
@@ -343,7 +349,9 @@ struct Generator {
343349
return CommandEndl(ss);
344350
}
345351

346-
void endl() { ss << '\n'; }
352+
void endl() {
353+
ss << '\n';
354+
}
347355

348356
void inject_includes(const std::vector<std::string> &includes) {
349357
if (!includes.empty()) {

src/error.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@
66
namespace cmkr {
77
namespace error {
88

9-
Status::Status(Code ec) noexcept : ec_(ec) {}
9+
Status::Status(Code ec) noexcept : ec_(ec) {
10+
}
1011

11-
Status::operator int() const noexcept { return static_cast<int>(ec_); }
12+
Status::operator int() const noexcept {
13+
return static_cast<int>(ec_);
14+
}
1215

13-
Status::Code Status::code() const noexcept { return ec_; }
16+
Status::Code Status::code() const noexcept {
17+
return ec_;
18+
}
1419

1520
} // namespace error
1621
} // namespace cmkr

src/help.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
namespace cmkr {
55
namespace help {
66

7-
const char *version() noexcept { return "cmkr version " CMKR_VERSION; }
7+
const char *version() noexcept {
8+
return "cmkr version " CMKR_VERSION;
9+
}
810

911
const char *message() noexcept {
1012
return R"lit(
@@ -22,6 +24,10 @@ Usage: cmkr [arguments]
2224
} // namespace help
2325
} // namespace cmkr
2426

25-
const char *cmkr_help_version(void) { return cmkr::help::version(); }
27+
const char *cmkr_help_version(void) {
28+
return cmkr::help::version();
29+
}
2630

27-
const char *cmkr_help_message(void) { return cmkr::help::message(); }
31+
const char *cmkr_help_message(void) {
32+
return cmkr::help::message();
33+
}

src/project_parser.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ class TomlChecker {
5454
tsl::ordered_set<toml::key> m_conditionVisited;
5555

5656
public:
57-
TomlChecker(const TomlBasicValue &v, const toml::key &ky) : m_v(toml::find(v, ky)) {}
58-
TomlChecker(const TomlBasicValue &v) : m_v(v) {}
57+
TomlChecker(const TomlBasicValue &v, const toml::key &ky) : m_v(toml::find(v, ky)) {
58+
}
59+
TomlChecker(const TomlBasicValue &v) : m_v(v) {
60+
}
5961
TomlChecker(const TomlChecker &) = delete;
6062
TomlChecker(TomlChecker &&) = delete;
6163

@@ -109,9 +111,13 @@ class TomlChecker {
109111
return toml::find(m_v, ky);
110112
}
111113

112-
void visit(const toml::key &ky) { m_visited.emplace(ky); }
114+
void visit(const toml::key &ky) {
115+
m_visited.emplace(ky);
116+
}
113117

114-
bool visisted(const toml::key &ky) const { return m_visited.contains(ky); }
118+
bool visisted(const toml::key &ky) const {
119+
return m_visited.contains(ky);
120+
}
115121

116122
void check(const tsl::ordered_map<std::string, std::string> &conditions) const {
117123
for (const auto &itr : m_v.as_table()) {
@@ -152,7 +158,8 @@ class TomlCheckerRoot {
152158
bool m_checked = false;
153159

154160
public:
155-
TomlCheckerRoot(const TomlBasicValue &root) : m_root(root) {}
161+
TomlCheckerRoot(const TomlBasicValue &root) : m_root(root) {
162+
}
156163
TomlCheckerRoot(const TomlCheckerRoot &) = delete;
157164
TomlCheckerRoot(TomlCheckerRoot &&) = delete;
158165

0 commit comments

Comments
 (0)