[clazy] [Bug 360374] New: Check for QString::left(1) mis-use.

Volker Krause via KDE Bugzilla bugzilla_noreply at kde.org
Thu Mar 10 18:37:25 GMT 2016


https://bugs.kde.org/show_bug.cgi?id=360374

            Bug ID: 360374
           Summary: Check for QString::left(1) mis-use.
           Product: clazy
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: wishlist
          Priority: NOR
         Component: general
          Assignee: unassigned-bugs at kde.org
          Reporter: vkrause at kde.org
                CC: smartins at kde.org

QString::left(1) is an inefficient way of saying QString::at(0) in most cases.

A quick grep over Qt and KDE sources show basically two use-cases (about 40-50
hits):
* str.left(1) == QStringLiteral("#") 
* str.left(1).toUpper() - typically used as part of string concatenations
Both cases would work with at(0) just as well, and at least the latter one
isn't caught yet by clazy.

Reproducible: Always

-- 
You are receiving this mail because:
You are the assignee for the bug.



More information about the Unassigned-bugs mailing list