diff options
author | sin-ack <sin-ack@users.noreply.github.com> | 2022-07-11 20:23:24 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-12 23:11:35 +0200 |
commit | 7456904a398c62cb87349fb4b47dd3e507fd634e (patch) | |
tree | b0fb2d75dd0aba46dd293e3b19cd9a178927f9c1 /Userland/Libraries/LibCore | |
parent | 7da00bfa8d03741e74a0a50f0c17a15b92ca94e2 (diff) | |
download | serenity-7456904a398c62cb87349fb4b47dd3e507fd634e.zip |
Meta+Userland: Simplify some formatters
These are mostly minor mistakes I've encountered while working on the
removal of StringView(char const*). The usage of builder.put_string over
Format<FormatString>::format is preferrable as it will avoid the
indirection altogether when there's no formatting to be done. Similarly,
there is no need to do format(builder, "{}", number) when
builder.put_u64(number) works equally well.
Additionally a few Strings where only constant strings were used are
replaced with StringViews.
Diffstat (limited to 'Userland/Libraries/LibCore')
-rw-r--r-- | Userland/Libraries/LibCore/Directory.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibCore/Directory.h b/Userland/Libraries/LibCore/Directory.h index 5eebe5f32c..1405477bce 100644 --- a/Userland/Libraries/LibCore/Directory.h +++ b/Userland/Libraries/LibCore/Directory.h @@ -62,8 +62,9 @@ struct Formatter<Core::Directory> : Formatter<StringView> { { auto path = directory.path(); if (path.is_error()) - return Formatter<StringView>::format(builder, "<unknown>"); - return Formatter<StringView>::format(builder, path.release_value().string()); + TRY(builder.put_string("<unknown>"sv)); + TRY(builder.put_string(path.release_value().string())); + return {}; } }; |