AK: Use string_view() instead of to_string() in Formatter<wchar_t>

This let's us avoid a heap allocation.
This commit is contained in:
Idan Horowitz 2022-02-16 00:03:54 +02:00 committed by Andreas Kling
parent ccad3d5a39
commit e95470702e

View file

@ -8,7 +8,6 @@
#include <AK/Format.h>
#include <AK/GenericLexer.h>
#include <AK/IntegralMath.h>
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/kstdio.h>
@ -777,7 +776,7 @@ ErrorOr<void> Formatter<wchar_t>::format(FormatBuilder& builder, wchar_t value)
codepoint.append_code_point(value);
Formatter<StringView> formatter { *this };
return formatter.format(builder, codepoint.to_string());
return formatter.format(builder, codepoint.string_view());
}
}
ErrorOr<void> Formatter<bool>::format(FormatBuilder& builder, bool value)