mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 09:13:07 +03:00
Move collapsible_else_if to pedantic (#16211)
Looks like a good number of people disagree with this lint so it shouldn't be on by default Fixes https://github.com/rust-lang/rust-clippy/issues/16209 changelog: [`collapsible_else_if`]: move to `pedantic`
This commit is contained in:
@@ -76,7 +76,7 @@
|
||||
/// ```
|
||||
#[clippy::version = "1.51.0"]
|
||||
pub COLLAPSIBLE_ELSE_IF,
|
||||
style,
|
||||
pedantic,
|
||||
"nested `else`-`if` expressions that can be collapsed (e.g., `else { if x { ... } }`)"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![allow(clippy::eq_op, clippy::nonminimal_bool)]
|
||||
#![warn(clippy::collapsible_if)]
|
||||
#![warn(clippy::collapsible_else_if)]
|
||||
|
||||
#[rustfmt::skip]
|
||||
fn main() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![allow(clippy::eq_op, clippy::nonminimal_bool)]
|
||||
#![warn(clippy::collapsible_if)]
|
||||
#![warn(clippy::collapsible_else_if)]
|
||||
|
||||
#[rustfmt::skip]
|
||||
fn main() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![allow(clippy::assertions_on_constants, clippy::equatable_if_let, clippy::needless_ifs)]
|
||||
#![warn(clippy::collapsible_if, clippy::collapsible_else_if)]
|
||||
#![warn(clippy::collapsible_else_if)]
|
||||
|
||||
#[rustfmt::skip]
|
||||
fn main() {
|
||||
@@ -88,30 +88,12 @@ fn issue_7318() {
|
||||
}
|
||||
|
||||
fn issue_13365() {
|
||||
// all the `expect`s that we should fulfill
|
||||
// ensure we fulfill `#[expect]`
|
||||
if true {
|
||||
} else {
|
||||
#[expect(clippy::collapsible_else_if)]
|
||||
if false {}
|
||||
}
|
||||
|
||||
if true {
|
||||
} else {
|
||||
#[expect(clippy::style)]
|
||||
if false {}
|
||||
}
|
||||
|
||||
if true {
|
||||
} else {
|
||||
#[expect(clippy::all)]
|
||||
if false {}
|
||||
}
|
||||
|
||||
if true {
|
||||
} else {
|
||||
#[expect(warnings)]
|
||||
if false {}
|
||||
}
|
||||
}
|
||||
|
||||
fn issue14799() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#![allow(clippy::assertions_on_constants, clippy::equatable_if_let, clippy::needless_ifs)]
|
||||
#![warn(clippy::collapsible_if, clippy::collapsible_else_if)]
|
||||
#![warn(clippy::collapsible_else_if)]
|
||||
|
||||
#[rustfmt::skip]
|
||||
fn main() {
|
||||
@@ -104,30 +104,12 @@ fn issue_7318() {
|
||||
}
|
||||
|
||||
fn issue_13365() {
|
||||
// all the `expect`s that we should fulfill
|
||||
// ensure we fulfill `#[expect]`
|
||||
if true {
|
||||
} else {
|
||||
#[expect(clippy::collapsible_else_if)]
|
||||
if false {}
|
||||
}
|
||||
|
||||
if true {
|
||||
} else {
|
||||
#[expect(clippy::style)]
|
||||
if false {}
|
||||
}
|
||||
|
||||
if true {
|
||||
} else {
|
||||
#[expect(clippy::all)]
|
||||
if false {}
|
||||
}
|
||||
|
||||
if true {
|
||||
} else {
|
||||
#[expect(warnings)]
|
||||
if false {}
|
||||
}
|
||||
}
|
||||
|
||||
fn issue14799() {
|
||||
|
||||
@@ -151,7 +151,7 @@ LL | | }
|
||||
| |_____^ help: collapse nested if block: `if false {}`
|
||||
|
||||
error: this `else { if .. }` block can be collapsed
|
||||
--> tests/ui/collapsible_else_if.rs:157:12
|
||||
--> tests/ui/collapsible_else_if.rs:139:12
|
||||
|
|
||||
LL | } else {
|
||||
| ____________^
|
||||
|
||||
Reference in New Issue
Block a user