From 79dec148a95980ff7e903f99bc3d9fb36eda1959 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 27 Aug 2024 18:44:13 +0200 Subject: [PATCH] QXmlString: add noexcept to size() and operator QStringView() size() is obviously noexcept. QStringView ctors have an implied precondition that the (ptr, n) range passed represent a valid range. Since this is a member function QXmlString, we can assume that the class variants hold and m_string itself represents valid (or null) data, so this operation is also noexcept. As a drive-by, remove pointless inline keywords. Change-Id: Ia7637e77005062b6515ceac4b62efaf14a2eb486 Reviewed-by: Thiago Macieira (cherry picked from commit 792bea9be3760f58de4d1c30fbecab0071fe311e) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/serialization/qxmlstream.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/serialization/qxmlstream.h b/src/corelib/serialization/qxmlstream.h index 670d88f3f05..978088c4a80 100644 --- a/src/corelib/serialization/qxmlstream.h +++ b/src/corelib/serialization/qxmlstream.h @@ -31,8 +31,8 @@ public: m_string.swap(other.m_string); } - inline operator QStringView() const { return QStringView(m_string.data(), m_string.size); } - inline qsizetype size() const { return m_string.size; } + operator QStringView() const noexcept { return QStringView(m_string.data(), m_string.size); } + qsizetype size() const noexcept { return m_string.size; } }; }