Skip to content

Commit 3ea5bcf

Browse files
committed
Auto merge of #11809 - hrxi:pr_if_same_then_else_style, r=Alexendoo
Change `if_same_then_else` to be a `style` lint CC #3770 From #3770 (comment) (`@flip1995):` > Oh I thought I replied to this: I definitely see now that having this > as a correctness lint might be the wrong categorization. What we might > want to do is to just allow this lint, if there are comments in the > arm bodies. But a good first step would be to downgrade this lint to > style or complexity. I would vote for style since merging two arms is > not always less complex. changelog: [`if_same_then_else`]: Change to be a `style` lint
2 parents 7ad3373 + b3073c5 commit 3ea5bcf

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clippy_lints/src/copies.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ declare_clippy_lint! {
117117
/// ```
118118
#[clippy::version = "pre 1.29.0"]
119119
pub IF_SAME_THEN_ELSE,
120-
correctness,
120+
style,
121121
"`if` with the same `then` and `else` blocks"
122122
}
123123

tests/ui/needless_bool_assign.stderr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ LL | } else {
4848
LL | | a.field = true;
4949
LL | | }
5050
| |_____^
51-
= note: `#[deny(clippy::if_same_then_else)]` on by default
51+
= note: `-D clippy::if-same-then-else` implied by `-D warnings`
52+
= help: to override `-D warnings` add `#[allow(clippy::if_same_then_else)]`
5253

5354
error: aborting due to 4 previous errors
5455

0 commit comments

Comments
 (0)