@@ -1093,8 +1093,8 @@ <h3>Configuration</h3>
10931093</ul>
10941094</div><div class="lint-additional-info"><div>Applicability: <span class="label applicability">Unspecified</span><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/enum.Applicability.html#variants">(?)</a></div><div>Added in: <span class="label label-version">pre 1.29.0</span></div><a href="https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+boxed_local">Related Issues</a><a href="https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/escape.rs#L28">View Source</a></div></div></article><article id="branches_sharing_code"><input id="label-branches_sharing_code" type="checkbox"><label for="label-branches_sharing_code"><h2 class="lint-title"><div class="panel-title-name" id="lint-branches_sharing_code">branches_sharing_code
10951095<a href="#branches_sharing_code" class="anchor label">¶</a> <a href="" class="copy-to-clipboard anchor label">📋</a></div><span class="label lint-group group-nursery">nursery</span> <span class="label lint-level level-allow">allow</span> <span class="label doc-folding"></span></h2></label><div class="lint-docs"><div class="lint-doc-md"><h3>What it does</h3>
1096- <p>Checks if the <code>if</code> and <code>else</code> block contain shared code that can be
1097- moved out of the blocks .</p>
1096+ <p>Checks if the blocks of an <code>if</code>/ <code>else</code>, or the arms of a <code>match</code>, contain shared code that
1097+ can be moved out of the branches .</p>
10981098<h3>Why is this bad?</h3>
10991099<p>Duplicate code is less maintainable.</p>
11001100<h3>Example</h3>
@@ -1114,6 +1114,20 @@ <h3>Example</h3>
11141114 42
11151115};
11161116</code></pre>
1117+ <p>For a <code>match</code>, when every arm ends with the same expression it can be moved after the
1118+ <code>match</code>:</p>
1119+ <pre><code class="language-rust">match mode {
1120+ Mode::A => { a(); Ok(()) }
1121+ Mode::B => { b(); Ok(()) }
1122+ }
1123+ </code></pre>
1124+ <p>Use instead:</p>
1125+ <pre><code class="language-rust">match mode {
1126+ Mode::A => { a(); }
1127+ Mode::B => { b(); }
1128+ }
1129+ Ok(())
1130+ </code></pre>
11171131</div><div class="lint-additional-info"><div>Applicability: <span class="label applicability">Unspecified</span><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/enum.Applicability.html#variants">(?)</a></div><div>Added in: <span class="label label-version">1.53.0</span></div><a href="https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+branches_sharing_code">Related Issues</a><a href="https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/ifs/mod.rs#L14">View Source</a></div></div></article><article id="builtin_type_shadow"><input id="label-builtin_type_shadow" type="checkbox"><label for="label-builtin_type_shadow"><h2 class="lint-title"><div class="panel-title-name" id="lint-builtin_type_shadow">builtin_type_shadow
11181132<a href="#builtin_type_shadow" class="anchor label">¶</a> <a href="" class="copy-to-clipboard anchor label">📋</a></div><span class="label lint-group group-style">style</span> <span class="label lint-level level-warn">warn</span> <span class="label doc-folding"></span></h2></label><div class="lint-docs"><div class="lint-doc-md"><h3>What it does</h3>
11191133<p>Warns if a generic shadows a built-in type.</p>
@@ -4840,7 +4854,7 @@ <h3>Example</h3>
48404854 42
48414855};
48424856</code></pre>
4843- </div><div class="lint-additional-info"><div>Applicability: <span class="label applicability">Unspecified</span><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/enum.Applicability.html#variants">(?)</a></div><div>Added in: <span class="label label-version">pre 1.29.0</span></div><a href="https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+if_same_then_else">Related Issues</a><a href="https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/ifs/mod.rs#L48 ">View Source</a></div></div></article><article id="if_then_some_else_none"><input id="label-if_then_some_else_none" type="checkbox"><label for="label-if_then_some_else_none"><h2 class="lint-title"><div class="panel-title-name" id="lint-if_then_some_else_none">if_then_some_else_none
4857+ </div><div class="lint-additional-info"><div>Applicability: <span class="label applicability">Unspecified</span><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/enum.Applicability.html#variants">(?)</a></div><div>Added in: <span class="label label-version">pre 1.29.0</span></div><a href="https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+if_same_then_else">Related Issues</a><a href="https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/ifs/mod.rs#L66 ">View Source</a></div></div></article><article id="if_then_some_else_none"><input id="label-if_then_some_else_none" type="checkbox"><label for="label-if_then_some_else_none"><h2 class="lint-title"><div class="panel-title-name" id="lint-if_then_some_else_none">if_then_some_else_none
48444858<a href="#if_then_some_else_none" class="anchor label">¶</a> <a href="" class="copy-to-clipboard anchor label">📋</a></div><span class="label lint-group group-restriction">restriction</span> <span class="label lint-level level-allow">allow</span> <span class="label doc-folding"></span></h2></label><div class="lint-docs"><div class="lint-doc-md"><h3>What it does</h3>
48454859<p>Checks for if-else that could be written using either <code>bool::then</code> or <code>bool::then_some</code>.</p>
48464860<h3>Why restrict this?</h3>
@@ -4895,7 +4909,7 @@ <h3>Configuration</h3>
48954909<p>(default: <code>["bytes::Bytes"]</code>)</p>
48964910</li>
48974911</ul>
4898- </div><div class="lint-additional-info"><div>Applicability: <span class="label applicability">Unspecified</span><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/enum.Applicability.html#variants">(?)</a></div><div>Added in: <span class="label label-version">pre 1.29.0</span></div><a href="https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+ifs_same_cond">Related Issues</a><a href="https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/ifs/mod.rs#L70 ">View Source</a></div></div></article><article id="ignore_without_reason"><input id="label-ignore_without_reason" type="checkbox"><label for="label-ignore_without_reason"><h2 class="lint-title"><div class="panel-title-name" id="lint-ignore_without_reason">ignore_without_reason
4912+ </div><div class="lint-additional-info"><div>Applicability: <span class="label applicability">Unspecified</span><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/enum.Applicability.html#variants">(?)</a></div><div>Added in: <span class="label label-version">pre 1.29.0</span></div><a href="https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+ifs_same_cond">Related Issues</a><a href="https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/ifs/mod.rs#L88 ">View Source</a></div></div></article><article id="ignore_without_reason"><input id="label-ignore_without_reason" type="checkbox"><label for="label-ignore_without_reason"><h2 class="lint-title"><div class="panel-title-name" id="lint-ignore_without_reason">ignore_without_reason
48994913<a href="#ignore_without_reason" class="anchor label">¶</a> <a href="" class="copy-to-clipboard anchor label">📋</a></div><span class="label lint-group group-pedantic">pedantic</span> <span class="label lint-level level-allow">allow</span> <span class="label doc-folding"></span></h2></label><div class="lint-docs"><div class="lint-doc-md"><h3>What it does</h3>
49004914<p>Checks for ignored tests without messages.</p>
49014915<h3>Why is this bad?</h3>
@@ -13869,7 +13883,7 @@ <h3>Example</h3>
1386913883 }
1387013884}
1387113885</code></pre>
13872- </div><div class="lint-additional-info"><div>Applicability: <span class="label applicability">Unspecified</span><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/enum.Applicability.html#variants">(?)</a></div><div>Added in: <span class="label label-version">1.41.0</span></div><a href="https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+same_functions_in_if_condition">Related Issues</a><a href="https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/ifs/mod.rs#L102 ">View Source</a></div></div></article><article id="same_item_push"><input id="label-same_item_push" type="checkbox"><label for="label-same_item_push"><h2 class="lint-title"><div class="panel-title-name" id="lint-same_item_push">same_item_push
13886+ </div><div class="lint-additional-info"><div>Applicability: <span class="label applicability">Unspecified</span><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lint_defs/enum.Applicability.html#variants">(?)</a></div><div>Added in: <span class="label label-version">1.41.0</span></div><a href="https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+same_functions_in_if_condition">Related Issues</a><a href="https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/ifs/mod.rs#L120 ">View Source</a></div></div></article><article id="same_item_push"><input id="label-same_item_push" type="checkbox"><label for="label-same_item_push"><h2 class="lint-title"><div class="panel-title-name" id="lint-same_item_push">same_item_push
1387313887<a href="#same_item_push" class="anchor label">¶</a> <a href="" class="copy-to-clipboard anchor label">📋</a></div><span class="label lint-group group-style">style</span> <span class="label lint-level level-warn">warn</span> <span class="label doc-folding"></span></h2></label><div class="lint-docs"><div class="lint-doc-md"><h3>What it does</h3>
1387413888<p>Checks whether a for loop is being used to push a constant
1387513889value into a Vec.</p>
0 commit comments