aboutsummaryrefslogtreecommitdiffstats
path: root/docs/checks/README-qstring-ref.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/checks/README-qstring-ref.md')
-rw-r--r--docs/checks/README-qstring-ref.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/checks/README-qstring-ref.md b/docs/checks/README-qstring-ref.md
new file mode 100644
index 00000000..7dcf05e8
--- /dev/null
+++ b/docs/checks/README-qstring-ref.md
@@ -0,0 +1,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"`