@@ -10352,23 +10352,24 @@ <h3>Example</h3>
10352
10352
];
10353
10353
</code></pre>
10354
10354
</div><div class="lint-additional-info-container"><div class="lint-additional-info-item"><span> Applicability: </span><span class="label label-default label-applicability">Unspecified</span><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/enum.Applicability.html#variants">(?)</a></div><div class="lint-additional-info-item"><span>Added in: </span><span class="label label-default label-version">pre 1.29.0</span></div><div class="lint-additional-info-item"><a href="https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+possible_missing_comma">Related Issues</a></div><div class="lint-additional-info-item"><a href="https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/formatting.rs#L95">View Source</a></div></div></div></article><article class="panel panel-default" id="precedence"><input id="label-precedence" type="checkbox"><label for="label-precedence" onclick="highlightIfNeeded('precedence')"><header class="panel-heading"><h2 class="panel-title"><div class="panel-title-name" id="lint-precedence"><span>precedence</span> <a href="#precedence" onclick="lintAnchor(event)" class="anchor label label-default">¶</a> <a href="" class="anchor label label-default" onclick="copyToClipboard(event)">📋</a></div><div class="panel-title-addons"><span class="label label-lint-group label-default label-group-complexity">complexity</span> <span class="label label-lint-level label-lint-level-warn">warn</span> <span class="label label-doc-folding"></span></div></h2></header></label><div class="list-group lint-docs"><div class="list-group-item lint-doc-md"><h3>What it does</h3>
10355
- <p>Checks for operations where precedence may be unclear
10356
- and suggests to add parentheses. Currently it catches the following:</p>
10357
- <ul>
10358
- <li>mixed usage of arithmetic and bit shifting/combining operators without
10359
- parentheses</li>
10360
- <li>mixed usage of bitmasking and bit shifting operators without parentheses</li>
10361
- </ul>
10355
+ <p>Checks for operations where precedence may be unclear and suggests to add parentheses.
10356
+ It catches a mixed usage of arithmetic and bit shifting/combining operators without parentheses</p>
10362
10357
<h3>Why is this bad?</h3>
10363
10358
<p>Not everyone knows the precedence of those operators by
10364
10359
heart, so expressions like these may trip others trying to reason about the
10365
10360
code.</p>
10366
10361
<h3>Example</h3>
10367
- <ul>
10368
- <li><code>1 << 2 + 3</code> equals 32, while <code>(1 << 2) + 3</code> equals 7</li>
10369
- <li><code>0x2345 & 0xF000 >> 12</code> equals 5, while <code>(0x2345 & 0xF000) >> 12</code> equals 2</li>
10370
- </ul>
10371
- </div><div class="lint-additional-info-container"><div class="lint-additional-info-item"><span> Applicability: </span><span class="label label-default label-applicability">MachineApplicable</span><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/enum.Applicability.html#variants">(?)</a></div><div class="lint-additional-info-item"><span>Added in: </span><span class="label label-default label-version">pre 1.29.0</span></div><div class="lint-additional-info-item"><a href="https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+precedence">Related Issues</a></div><div class="lint-additional-info-item"><a href="https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/precedence.rs#L10">View Source</a></div></div></div></article><article class="panel panel-default" id="print_in_format_impl"><input id="label-print_in_format_impl" type="checkbox"><label for="label-print_in_format_impl" onclick="highlightIfNeeded('print_in_format_impl')"><header class="panel-heading"><h2 class="panel-title"><div class="panel-title-name" id="lint-print_in_format_impl"><span>print_in_format_impl</span> <a href="#print_in_format_impl" onclick="lintAnchor(event)" class="anchor label label-default">¶</a> <a href="" class="anchor label label-default" onclick="copyToClipboard(event)">📋</a></div><div class="panel-title-addons"><span class="label label-lint-group label-default label-group-suspicious">suspicious</span> <span class="label label-lint-level label-lint-level-warn">warn</span> <span class="label label-doc-folding"></span></div></h2></header></label><div class="list-group lint-docs"><div class="list-group-item lint-doc-md"><h3>What it does</h3>
10362
+ <p><code>1 << 2 + 3</code> equals 32, while <code>(1 << 2) + 3</code> equals 7</p>
10363
+ </div><div class="lint-additional-info-container"><div class="lint-additional-info-item"><span> Applicability: </span><span class="label label-default label-applicability">MachineApplicable</span><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/enum.Applicability.html#variants">(?)</a></div><div class="lint-additional-info-item"><span>Added in: </span><span class="label label-default label-version">pre 1.29.0</span></div><div class="lint-additional-info-item"><a href="https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+precedence">Related Issues</a></div><div class="lint-additional-info-item"><a href="https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/precedence.rs#L10">View Source</a></div></div></div></article><article class="panel panel-default" id="precedence_bits"><input id="label-precedence_bits" type="checkbox"><label for="label-precedence_bits" onclick="highlightIfNeeded('precedence_bits')"><header class="panel-heading"><h2 class="panel-title"><div class="panel-title-name" id="lint-precedence_bits"><span>precedence_bits</span> <a href="#precedence_bits" onclick="lintAnchor(event)" class="anchor label label-default">¶</a> <a href="" class="anchor label label-default" onclick="copyToClipboard(event)">📋</a></div><div class="panel-title-addons"><span class="label label-lint-group label-default label-group-restriction">restriction</span> <span class="label label-lint-level label-lint-level-allow">allow</span> <span class="label label-doc-folding"></span></div></h2></header></label><div class="list-group lint-docs"><div class="list-group-item lint-doc-md"><h3>What it does</h3>
10364
+ <p>Checks for bit shifting operations combined with bit masking/combining operators
10365
+ and suggest using parentheses.</p>
10366
+ <h3>Why restrict this?</h3>
10367
+ <p>Not everyone knows the precedence of those operators by
10368
+ heart, so expressions like these may trip others trying to reason about the
10369
+ code.</p>
10370
+ <h3>Example</h3>
10371
+ <p><code>0x2345 & 0xF000 >> 12</code> equals 5, while <code>(0x2345 & 0xF000) >> 12</code> equals 2</p>
10372
+ </div><div class="lint-additional-info-container"><div class="lint-additional-info-item"><span> Applicability: </span><span class="label label-default label-applicability">MachineApplicable</span><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/enum.Applicability.html#variants">(?)</a></div><div class="lint-additional-info-item"><span>Added in: </span><span class="label label-default label-version">1.86.0</span></div><div class="lint-additional-info-item"><a href="https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+precedence_bits">Related Issues</a></div><div class="lint-additional-info-item"><a href="https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/precedence.rs#L28">View Source</a></div></div></div></article><article class="panel panel-default" id="print_in_format_impl"><input id="label-print_in_format_impl" type="checkbox"><label for="label-print_in_format_impl" onclick="highlightIfNeeded('print_in_format_impl')"><header class="panel-heading"><h2 class="panel-title"><div class="panel-title-name" id="lint-print_in_format_impl"><span>print_in_format_impl</span> <a href="#print_in_format_impl" onclick="lintAnchor(event)" class="anchor label label-default">¶</a> <a href="" class="anchor label label-default" onclick="copyToClipboard(event)">📋</a></div><div class="panel-title-addons"><span class="label label-lint-group label-default label-group-suspicious">suspicious</span> <span class="label label-lint-level label-lint-level-warn">warn</span> <span class="label label-doc-folding"></span></div></h2></header></label><div class="list-group lint-docs"><div class="list-group-item lint-doc-md"><h3>What it does</h3>
10372
10373
<p>Checks for usage of <code>println</code>, <code>print</code>, <code>eprintln</code> or <code>eprint</code> in an
10373
10374
implementation of a formatting trait.</p>
10374
10375
<h3>Why is this bad?</h3>
0 commit comments