diff options
author | Marc Mutz <[email protected]> | 2022-10-05 07:29:16 +0200 |
---|---|---|
committer | Marc Mutz <[email protected]> | 2022-10-07 23:38:48 +0200 |
commit | 958cd3ee1094a068b6d0ff27c73a4b3caff088ad (patch) | |
tree | 6d3816fedf5dab2307675fd6ef70d39758e246f5 /src/qmltest/quicktest.cpp | |
parent | e8e03215654ca730243336a80453cf9396cbdf58 (diff) |
Port from container::count() and length() to size()
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8:
auto QtContainerClass = anyOf(
expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o),
expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o));
makeRule(cxxMemberCallExpr(on(QtContainerClass),
callee(cxxMethodDecl(hasAnyName({"count", "length"),
parameterCountIs(0))))),
changeTo(cat(access(o, cat("size"), "()"))),
cat("use 'size()' instead of 'count()/length()'"))
a.k.a qt-port-to-std-compatible-api with config Scope: 'Container',
with the extended set of container classes recognized.
Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7
Reviewed-by: Fabian Kosmale <[email protected]>
Diffstat (limited to 'src/qmltest/quicktest.cpp')
-rw-r--r-- | src/qmltest/quicktest.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index 149b8bae3e..0d6638c8b1 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -167,8 +167,8 @@ bool QQuickTest::qWaitForPolish(const QQuickWindow *window, int timeout) static inline QString stripQuotes(const QString &s) { - if (s.length() >= 2 && s.startsWith(QLatin1Char('"')) && s.endsWith(QLatin1Char('"'))) - return s.mid(1, s.length() - 2); + if (s.size() >= 2 && s.startsWith(QLatin1Char('"')) && s.endsWith(QLatin1Char('"'))) + return s.mid(1, s.size() - 2); else return s; } @@ -663,7 +663,7 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch qWarning() << "Could not find the following test functions:"; for (const QString &functionName : qAsConst(commandLineTestFunctions)) qWarning(" %s()", qUtf8Printable(functionName)); - return commandLineTestFunctions.count(); + return commandLineTestFunctions.size(); } // Return the number of failures as the exit code. |