fix: Redundant condition in isValidBasicType

When isValid is true, it must be true; when isValidis false,
whether the conditional judgment is true ornot only depends
on whether !result is true(eg: A | | (!A && B) is equivalent to A | | B.),
so you can optimize the judgment condition to improve thereadability
of the code.

Change-Id: I0231b83e0b50586dff2820b8d0dfc35edec36f70
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 03c547f1010868a0ef2f236c6980094efab7e12f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tian Shilin 2024-08-22 16:21:54 +08:00 committed by Qt Cherry-pick Bot
parent 225e235cf9
commit 9de69c4a99

View File

@ -195,7 +195,7 @@ void tst_QDBusType::isValidBasicType()
QFETCH(bool, result);
QFETCH(bool, isValid);
QVERIFY2(data.size() == 1, "Test is malformed, this function must test only one-letter types");
QVERIFY(isValid || (!isValid && !result));
QVERIFY(isValid || !result);
int type = data.at(0).unicode();
if (isValid)