rustmaker: Avoid string copy (loplugin:stringview)

Address the following clang plugin error seen in an
--enable-rust-uno build:

    /home/michi/development/git/libreoffice/codemaker/source/rustmaker/cpproduce.cxx:1016:41: error: rather than copy, pass with a view using subView() [loplugin:stringview]
     1016 |                             && (unoType.copy(unoType.lastIndexOf('.') + 1).startsWith("X")));
          |                                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Change-Id: Icec8b529abf67ca13243da21136d5f296f53b7d5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190854
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
This commit is contained in:
Michael Weghorn
2025-09-12 13:57:19 +02:00
parent 5ecb0b6f95
commit 257f798461
+1 -1
View File
@@ -1013,7 +1013,7 @@ void CppProducer::generateStructMemberAccessors(CppFile& file, std::string_view
// UNO interface types start with "com.sun.star" and end with an interface name (typically starting with "X")
// Examples: "com.sun.star.uno.XInterface", "com.sun.star.text.XText"
bool isInterfaceType = (unoType.startsWith("com.sun.star.") && (unoType.lastIndexOf('.') != -1)
&& (unoType.copy(unoType.lastIndexOf('.') + 1).startsWith("X")));
&& (unoType.subView(unoType.lastIndexOf('.') + 1).starts_with('X')));
if (isInterfaceType)
{