Skip to content

Commit

Permalink
Change if_same_then_else to be a style lint
Browse files Browse the repository at this point in the history
CC rust-lang#3770

From rust-lang#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.
  • Loading branch information
hrxi committed Nov 14, 2023
1 parent 0c42e45 commit 8ba1b0e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/copies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ declare_clippy_lint! {
/// ```
#[clippy::version = "pre 1.29.0"]
pub IF_SAME_THEN_ELSE,
correctness,
style,
"`if` with the same `then` and `else` blocks"
}

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/needless_bool_assign.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ LL | } else {
LL | | a.field = true;
LL | | }
| |_____^
= note: `#[deny(clippy::if_same_then_else)]` on by default
= note: `-D clippy::if-same-then-else` implied by `-D warnings`

error: aborting due to 4 previous errors

0 comments on commit 8ba1b0e

Please sign in to comment.