| 1 |
.. title:: clang-tidy - abseil-str-cat-append |
| 2 |
|
| 3 |
abseil-str-cat-append |
| 4 |
===================== |
| 5 |
|
| 6 |
Flags uses of ``absl::StrCat()`` to append to a ``std::string``. Suggests |
| 7 |
``absl::StrAppend()`` should be used instead. |
| 8 |
|
| 9 |
The extra calls cause unnecessary temporary strings to be constructed. Removing |
| 10 |
them makes the code smaller and faster. |
| 11 |
|
| 12 |
.. code-block:: c++ |
| 13 |
|
| 14 |
a = absl::StrCat(a, b); // Use absl::StrAppend(&a, b) instead. |
| 15 |
|
| 16 |
Does not diagnose cases where ``absl::StrCat()`` is used as a template |
| 17 |
argument for a functor. |