From e95470702e574250f49947b68e7f9b8a94f6e2c4 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Wed, 16 Feb 2022 00:03:54 +0200 Subject: [PATCH] AK: Use string_view() instead of to_string() in Formatter This let's us avoid a heap allocation. --- AK/Format.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/AK/Format.cpp b/AK/Format.cpp index 4c00e3f6da..63e9ff8689 100644 --- a/AK/Format.cpp +++ b/AK/Format.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include @@ -777,7 +776,7 @@ ErrorOr Formatter::format(FormatBuilder& builder, wchar_t value) codepoint.append_code_point(value); Formatter formatter { *this }; - return formatter.format(builder, codepoint.to_string()); + return formatter.format(builder, codepoint.string_view()); } } ErrorOr Formatter::format(FormatBuilder& builder, bool value)