summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibRegex
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-06-24 21:13:09 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-24 21:13:09 +0200
commite59bf87374f7cf7c58f0a08a4df2c92b4094b180 (patch)
tree8b7d8074c382c2fc5487450c0ca4b3eb4a2956f3 /Userland/Libraries/LibRegex
parent7fef8c5648769090de9df44ee324cc4a72f1c5aa (diff)
downloadserenity-e59bf87374f7cf7c58f0a08a4df2c92b4094b180.zip
Userland: Replace VERIFY(is<T>) with verify_cast<T>
Instead of doing a VERIFY(is<T>(x)) and *then* casting it to T, we can just do the cast right away with verify_cast<T>. :^)
Diffstat (limited to 'Userland/Libraries/LibRegex')
-rw-r--r--Userland/Libraries/LibRegex/RegexByteCode.h17
1 files changed, 7 insertions, 10 deletions
diff --git a/Userland/Libraries/LibRegex/RegexByteCode.h b/Userland/Libraries/LibRegex/RegexByteCode.h
index df5207877d..4ab85fd967 100644
--- a/Userland/Libraries/LibRegex/RegexByteCode.h
+++ b/Userland/Libraries/LibRegex/RegexByteCode.h
@@ -15,6 +15,7 @@
#include <AK/NonnullOwnPtr.h>
#include <AK/OwnPtr.h>
#include <AK/Traits.h>
+#include <AK/TypeCasts.h>
#include <AK/Types.h>
#include <AK/Vector.h>
@@ -720,31 +721,27 @@ ALWAYS_INLINE bool is<OpCode_Compare>(const OpCode& opcode)
}
template<typename T>
-ALWAYS_INLINE const T& to(const OpCode& opcode)
+ALWAYS_INLINE T const& to(OpCode const& opcode)
{
- VERIFY(is<T>(opcode));
- return static_cast<const T&>(opcode);
+ return verify_cast<T>(opcode);
}
template<typename T>
ALWAYS_INLINE T* to(OpCode* opcode)
{
- VERIFY(is<T>(opcode));
- return static_cast<T*>(opcode);
+ return verify_cast<T>(opcode);
}
template<typename T>
-ALWAYS_INLINE const T* to(const OpCode* opcode)
+ALWAYS_INLINE T const* to(OpCode const* opcode)
{
- VERIFY(is<T>(opcode));
- return static_cast<const T*>(opcode);
+ return verify_cast<T>(opcode);
}
template<typename T>
ALWAYS_INLINE T& to(OpCode& opcode)
{
- VERIFY(is<T>(opcode));
- return static_cast<T&>(opcode);
+ return verify_cast<T>(opcode);
}
}