about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-11-15 12:11:14 +0000
committerbors <bors@rust-lang.org>2023-11-15 12:11:14 +0000
commit3ea5bcf5ee614c32a528389b846c1f6016ef2436 (patch)
tree0c94c9c0864812eb86693e5c9bea81faf0a3afd1
parent7ad3373bb17507dbee0e67f64955e85d9295f09f (diff)
parentb3073c536b349e6c80e24d8e85182d6d990c4c50 (diff)
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 https://github.com/rust-lang/rust-clippy/issues/3770#issuecomment-687565594 (`@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
-rw-r--r--clippy_lints/src/copies.rs2
-rw-r--r--tests/ui/needless_bool_assign.stderr3
2 files changed, 3 insertions, 2 deletions
diff --git a/clippy_lints/src/copies.rs b/clippy_lints/src/copies.rs
index e3a09636e24..3b6d4886ba3 100644
--- a/clippy_lints/src/copies.rs
+++ b/clippy_lints/src/copies.rs
@@ -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"
 }
 
diff --git a/tests/ui/needless_bool_assign.stderr b/tests/ui/needless_bool_assign.stderr
index 7866c89bd61..244a88e6691 100644
--- a/tests/ui/needless_bool_assign.stderr
+++ b/tests/ui/needless_bool_assign.stderr
@@ -48,7 +48,8 @@ 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`
+   = help: to override `-D warnings` add `#[allow(clippy::if_same_then_else)]`
 
 error: aborting due to 4 previous errors