Bug 1609943 - Improved section on comparison against true/false, and added note on clang-tidy check. r=sylvestre

Depends on D60281

Differential Revision: https://phabricator.services.mozilla.com/D60282

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Simon Giesecke 2020-01-20 12:37:31 +00:00
Родитель 3e22e77cc5
Коммит 3f5316df28
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -325,8 +325,14 @@ C/C++ practices
- When testing a pointer, use ``(!myPtr)`` or ``(myPtr)``;
don't use ``myPtr != nullptr`` or ``myPtr == nullptr``.
- Do not compare ``x == true`` or ``x == false``. Use ``(x)`` or
``(!x)`` instead. ``x == true``, is certainly different from if
``(x)``!
``(!x)`` instead. ``if (x == true)`` may have semantics different from
``if (x)``!
.. note:
clang-tidy provides the ``readability-simplify-boolean-expr`` check
with autofixes that checks for these and some other boolean expressions
that can be simplified.
- In general, initialize variables with ``nsFoo aFoo = bFoo,`` and not
``nsFoo aFoo(bFoo)``.