Skip to content

Commit c758c36

Browse files
committed
works (tests + description TODO)
also removed RAII guard because it didn't work for some reason
1 parent 78f94e2 commit c758c36

File tree

8 files changed

+248
-217
lines changed

8 files changed

+248
-217
lines changed

clippy_lints/src/excessive_nesting.rs

Lines changed: 207 additions & 126 deletions
Large diffs are not rendered by default.

tests/ui-toml/excessive_nesting/excessive_nesting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![allow(unused)]
2-
#![warn(clippy::excessive_indentation)]
2+
#![warn(clippy::excessive_nesting)]
33

44
#[rustfmt::skip]
55
fn main() {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error: this block is too nested
2+
--> $DIR/excessive_nesting.rs:8:13
3+
|
4+
LL | / {
5+
LL | | {
6+
LL | | println!("warning! :)");
7+
LL | | }
8+
LL | | }
9+
| |_____________^
10+
|
11+
= help: try refactoring your code, extraction is often both easier to read and less nested
12+
= note: `-D clippy::excessive-nesting` implied by `-D warnings`
13+
14+
error: aborting due to previous error
15+

tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ error: error reading Clippy's configuration file `$DIR/clippy.toml`: unknown fie
2424
enforced-import-renames
2525
enum-variant-name-threshold
2626
enum-variant-size-threshold
27+
excessive-nesting-threshold
2728
future-size-threshold
2829
ignore-interior-mutability
2930
large-error-threshold

tests/ui/excessive_nesting.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#![allow(unused)]
2-
#![warn(clippy::excessive_indentation)]
2+
#![warn(clippy::excessive_nesting)]
33

44
#[rustfmt::skip]
55
use a::{b::{c::{d::{e::{f::{g::{h::{i::j::{k::{l::{m::{n::{o::{p::{}}}}}}}}}}}}}}};
66

7+
fn a() {}
8+
9+
fn b() {
10+
{}
11+
}
12+
713
pub mod a {
814
pub mod b {
915
pub mod c {

tests/ui/excessive_nesting.stderr

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error: this block is too nested
2+
--> $DIR/excessive_nesting.rs:58:41
3+
|
4+
LL | / ... {
5+
LL | | ... {
6+
LL | | ... {
7+
LL | | ... {
8+
... |
9+
LL | | ... }
10+
LL | | ... }
11+
| |_______________________^
12+
|
13+
= help: try refactoring your code, extraction is often both easier to read and less nested
14+
= note: `-D clippy::excessive-nesting` implied by `-D warnings`
15+
16+
error: aborting due to previous error
17+

tests/ui/excessive_width.rs

Lines changed: 0 additions & 51 deletions
This file was deleted.

tests/ui/excessive_width.stderr

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)