summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGUI
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2023-04-27 21:21:19 +0330
committerAndreas Kling <kling@serenityos.org>2023-04-28 05:55:20 +0200
commit7e6341587ba174309989ddebf7cc6a489751b0a8 (patch)
treec6c3c2cd4473340f03c513c8995a4a7751f6237b /Userland/Libraries/LibGUI
parentcc35bab143e022baf570e910c0a14dbf62ff2cdd (diff)
downloadserenity-7e6341587ba174309989ddebf7cc6a489751b0a8.zip
AK+Everywhere: Disallow Error::from_string_view(FooString)
That pattern seems to show up a lot in code written by people that aren't intimately familiar with the lifetime model of Error and Strings. This commit makes the compiler detect it and present a more helpful diagnostic than "garbage string at runtime".
Diffstat (limited to 'Userland/Libraries/LibGUI')
-rw-r--r--Userland/Libraries/LibGUI/JsonArrayModel.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGUI/JsonArrayModel.cpp b/Userland/Libraries/LibGUI/JsonArrayModel.cpp
index 97733033d0..b5baec6a60 100644
--- a/Userland/Libraries/LibGUI/JsonArrayModel.cpp
+++ b/Userland/Libraries/LibGUI/JsonArrayModel.cpp
@@ -89,7 +89,7 @@ ErrorOr<void> JsonArrayModel::set(int row, Vector<JsonValue>&& fields)
VERIFY(fields.size() == m_fields.size());
if ((size_t)row >= m_array.size())
- return Error::from_string_view(TRY(String::formatted("Row out of bounds: {} >= {}", row, m_array.size())));
+ return Error::from_string_view("Row out of bounds"sv);
JsonObject obj;
for (size_t i = 0; i < m_fields.size(); ++i) {
@@ -106,7 +106,7 @@ ErrorOr<void> JsonArrayModel::set(int row, Vector<JsonValue>&& fields)
ErrorOr<void> JsonArrayModel::remove(int row)
{
if ((size_t)row >= m_array.size())
- return Error::from_string_view(TRY(String::formatted("Row out of bounds: {} >= {}", row, m_array.size())));
+ return Error::from_string_view("Row out of bounds"sv);
JsonArray new_array;
for (size_t i = 0; i < m_array.size(); ++i)