aboutsummaryrefslogtreecommitdiffstats
path: root/src/checks/level0/README-qstring-ref.md
blob: 7dcf05e83ba881efbba2d0b90d0d387bb059af03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# qstring-ref

Finds places where `QString::fooRef()` should be used instead of `QString::foo()`, to avoid temporary heap allocations.

#### Example

    str.mid(5).toInt(ok) // BAD

    str.midRef(5).toInt(ok) // GOOD

Where `mid` can be any of: `mid`, `left`, `right`.
And `toInt()` can be any of: `compare`, `contains`, `count`, `startsWith`, `endsWith`, `indexOf`, `isEmpty`, `isNull`, `lastIndexOf`, `length`, `size`, `to*`, `trimmed`

#### FixIts

Fixing the above cases can be automated with:
`export CLAZY_FIXIT="fix-missing-qstringref"`