Most style guides discourage multiple statements on a single line because it reduces code clarity and maintainability. Automatically allowing it would encourage less readable code...
Also, as this is not in high demand, it's seen as an orphaned feature risk (adding a feature that is used by very few people or in very specific cases, which then doesn’t get proper ongoing support or updates. Over time, as the main codebase evolves, this rarely used feature might break or become incompatible because maintainers focus on the core functionality).
That being said, you could have a simple templated debug function that would let you do what you want in one call, so will stay on one line
void debug() {
Serial.println();
}
template<typename T, typename... Args>
void debug(T first, Args... args) {
Serial.print(first);
Serial.write(' ');
debug(args...);
}
int f() {
return 42;
}
void setup() {
Serial.begin(115200);
debug("Hi there");
debug("first", F("second"));
debug(F("Hello =>"), 2, 3, f());
}
void loop() {}
➜ you would call
debug(F(" NewMode ="), ModeToString(NewMode), F("LastMode ="), ModeToString(LastMode));
now you have one line ![]()
For switch-case formatting, the closest applicable option is probably to explore what you can do with AllowShortBlocksOnASingleLine: Always , which allows braces with content to stay on a single line. However, ClangFormat will still place the case label on its own line and indent the block as it's the typical way people do things.