formatter: extract formatting into a rules abstraction, add inner formatting (body vs argument functions) (#2684)

This commit is contained in:
Tyler Wilding
2023-06-04 12:19:29 -05:00
committed by GitHub
parent d41858c61c
commit 6d620a9289
15 changed files with 449 additions and 80 deletions
+2
View File
@@ -27,6 +27,8 @@ std::string ltrim(const std::string& s) {
return (start == std::string::npos) ? "" : s.substr(start);
}
// TODO - used a lot in formatting, and its slow because i bet it iterates from the start and not
// the end
std::string rtrim(const std::string& s) {
size_t end = s.find_last_not_of(WHITESPACE);
return (end == std::string::npos) ? "" : s.substr(0, end + 1);