]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
refactor: Avoid raw fmt::format call in TextTable
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 18 Feb 2024 08:33:36 +0000 (09:33 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 18 Feb 2024 11:37:56 +0000 (12:37 +0100)
src/util/TextTable.cpp

index 58d01a63b298e746f48a8df521b6513f4f3c5241..2727d566381836ffd32f78e442db991df5885403 100644 (file)
@@ -19,6 +19,7 @@
 #include "TextTable.hpp"
 
 #include <util/assertions.hpp>
+#include <util/fmtmacros.hpp>
 
 #include <third_party/fmt/core.h>
 
@@ -106,8 +107,8 @@ TextTable::render() const
       for (size_t j = i + 1 - cell.m_colspan; j <= i; ++j) {
         width += column_widths[j] + (j == i ? 0 : 1);
       }
-      r += fmt::format(
-        (cell.m_right_align ? "{:>{}}" : "{:<{}}"), cell.m_text, width);
+      r += cell.m_right_align ? FMT("{:>{}}", cell.m_text, width)
+                              : FMT("{:<{}}", cell.m_text, width);
     }
     result.append(r, 0, r.find_last_not_of(' ') + 1);
     result += '\n';