diff --git a/AK/GenericLexer.cpp b/AK/GenericLexer.cpp index e2db5e3867d15e..e1beb36c63a97a 100644 --- a/AK/GenericLexer.cpp +++ b/AK/GenericLexer.cpp @@ -19,9 +19,6 @@ namespace AK { // Consume a number of characters StringView GenericLexer::consume(size_t count) { - if (count == 0) - return {}; - size_t start = m_index; size_t length = min(count, m_input.length() - m_index); m_index += length; @@ -32,9 +29,6 @@ StringView GenericLexer::consume(size_t count) // Consume the rest of the input StringView GenericLexer::consume_all() { - if (is_eof()) - return {}; - auto rest = m_input.substring_view(m_index, m_input.length() - m_index); m_index = m_input.length(); return rest; @@ -51,8 +45,6 @@ StringView GenericLexer::consume_line() consume_specific('\r'); consume_specific('\n'); - if (length == 0) - return {}; return m_input.substring_view(start, length); } @@ -64,8 +56,6 @@ StringView GenericLexer::consume_until(char stop) m_index++; size_t length = m_index - start; - if (length == 0) - return {}; return m_input.substring_view(start, length); } @@ -77,8 +67,6 @@ StringView GenericLexer::consume_until(char const* stop) m_index++; size_t length = m_index - start; - if (length == 0) - return {}; return m_input.substring_view(start, length); } @@ -90,8 +78,6 @@ StringView GenericLexer::consume_until(StringView stop) m_index++; size_t length = m_index - start; - if (length == 0) - return {}; return m_input.substring_view(start, length); } diff --git a/AK/GenericLexer.h b/AK/GenericLexer.h index f2ac94fe4993f6..fc7990c6c90b5a 100644 --- a/AK/GenericLexer.h +++ b/AK/GenericLexer.h @@ -190,8 +190,6 @@ class GenericLexer { ++m_index; size_t length = m_index - start; - if (length == 0) - return {}; return m_input.substring_view(start, length); } @@ -204,8 +202,6 @@ class GenericLexer { ++m_index; size_t length = m_index - start; - if (length == 0) - return {}; return m_input.substring_view(start, length); }