diff options
| author | Alejandra González <blyxyas@gmail.com> | 2025-08-04 22:57:06 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-04 22:57:06 +0000 |
| commit | 264bc97b2623f29109e0ecb91d66cdb6c7b10a43 (patch) | |
| tree | 44fc0453f672ad1a425b0d0584eebf7ce2dc0a95 /tests | |
| parent | 826e514e4469bdd6e647df4bfd0fd2542bd9b62b (diff) | |
| parent | 9e50049157eb783ad7bf40c3f4e0cff1f8f2d3bf (diff) | |
| download | rust-264bc97b2623f29109e0ecb91d66cdb6c7b10a43.tar.gz rust-264bc97b2623f29109e0ecb91d66cdb6c7b10a43.zip | |
Split `possible_missing_else` from `suspicious_else_formatting` (#15317)
This has always been one lint (added in rust-lang/rust-clippy#720), but the two cases are also quite distinct. changelog: Split `possible_missing_else` from `suspicious_else_formatting` <!-- TRIAGEBOT_START --> <!-- TRIAGEBOT_SUMMARY_START --> ### Summary Notes - [Feature-freeze](https://github.com/rust-lang/rust-clippy/pull/15317#issuecomment-3094592022) by [github-actions[bot]](https://github.com/github-actions[bot]) *Managed by `@rustbot`—see [help](https://forge.rust-lang.org/triagebot/note.html) for details* <!-- TRIAGEBOT_SUMMARY_END --> <!-- TRIAGEBOT_END -->
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/suspicious_else_formatting.rs | 10 | ||||
| -rw-r--r-- | tests/ui/suspicious_else_formatting.stderr | 6 |
2 files changed, 9 insertions, 7 deletions
diff --git a/tests/ui/suspicious_else_formatting.rs b/tests/ui/suspicious_else_formatting.rs index 28a3b551116..072e7b27b0d 100644 --- a/tests/ui/suspicious_else_formatting.rs +++ b/tests/ui/suspicious_else_formatting.rs @@ -1,6 +1,6 @@ //@aux-build:proc_macro_suspicious_else_formatting.rs -#![warn(clippy::suspicious_else_formatting)] +#![warn(clippy::suspicious_else_formatting, clippy::possible_missing_else)] #![allow( clippy::if_same_then_else, clippy::let_unit_value, @@ -20,12 +20,12 @@ fn main() { // weird `else` formatting: if foo() { } { - //~^ suspicious_else_formatting + //~^ possible_missing_else } if foo() { } if foo() { - //~^ suspicious_else_formatting + //~^ possible_missing_else } let _ = { // if as the last expression @@ -33,7 +33,7 @@ fn main() { if foo() { } if foo() { - //~^ suspicious_else_formatting + //~^ possible_missing_else } else { } @@ -42,7 +42,7 @@ fn main() { let _ = { // if in the middle of a block if foo() { } if foo() { - //~^ suspicious_else_formatting + //~^ possible_missing_else } else { } diff --git a/tests/ui/suspicious_else_formatting.stderr b/tests/ui/suspicious_else_formatting.stderr index affd20b22d9..04555c6edbd 100644 --- a/tests/ui/suspicious_else_formatting.stderr +++ b/tests/ui/suspicious_else_formatting.stderr @@ -5,8 +5,8 @@ LL | } { | ^ | = note: to remove this lint, add the missing `else` or add a new line before the next block - = note: `-D clippy::suspicious-else-formatting` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(clippy::suspicious_else_formatting)]` + = note: `-D clippy::possible-missing-else` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::possible_missing_else)]` error: this looks like an `else if` but the `else` is missing --> tests/ui/suspicious_else_formatting.rs:27:6 @@ -41,6 +41,8 @@ LL | | { | |____^ | = note: to remove this lint, remove the `else` or remove the new line between `else` and `{..}` + = note: `-D clippy::suspicious-else-formatting` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(clippy::suspicious_else_formatting)]` error: this is an `else if` but the formatting might hide it --> tests/ui/suspicious_else_formatting.rs:67:6 |
