diff --git a/tests/ui/struct_fields.rs b/tests/ui/struct_fields.rs index 8e5d901a0ce9..f08916db3299 100644 --- a/tests/ui/struct_fields.rs +++ b/tests/ui/struct_fields.rs @@ -45,6 +45,21 @@ struct DoublePostfix { c_some_data: bool, } +#[allow(non_snake_case)] +struct NotSnakeCase { + //~^ ERROR: all fields have the same postfix: `someData` + a_someData: bool, + b_someData: bool, + c_someData: bool, +} +#[allow(non_snake_case)] +struct NotSnakeCase2 { + //~^ ERROR: all fields have the same prefix: `someData` + someData_c: bool, + someData_b: bool, + someData_a_b: bool, +} + // no error, threshold is 3 fiels by default struct Fooo { foo: u8, diff --git a/tests/ui/struct_fields.stderr b/tests/ui/struct_fields.stderr index cbbe456b30bc..8ecd4d0e3343 100644 --- a/tests/ui/struct_fields.stderr +++ b/tests/ui/struct_fields.stderr @@ -65,8 +65,34 @@ LL | | } | = help: remove the postfixes +error: all fields have the same postfix: `someData` + --> $DIR/struct_fields.rs:49:1 + | +LL | / struct NotSnakeCase { +LL | | +LL | | a_someData: bool, +LL | | b_someData: bool, +LL | | c_someData: bool, +LL | | } + | |_^ + | + = help: remove the postfixes + +error: all fields have the same prefix: `someData` + --> $DIR/struct_fields.rs:56:1 + | +LL | / struct NotSnakeCase2 { +LL | | +LL | | someData_c: bool, +LL | | someData_b: bool, +LL | | someData_a_b: bool, +LL | | } + | |_^ + | + = help: remove the prefixes + error: all fields have the same prefix: `prefix` - --> $DIR/struct_fields.rs:54:1 + --> $DIR/struct_fields.rs:69:1 | LL | / struct NonCaps { LL | | @@ -79,7 +105,7 @@ LL | | } = help: remove the prefixes error: all fields have the same prefix: `_type` - --> $DIR/struct_fields.rs:104:5 + --> $DIR/struct_fields.rs:119:5 | LL | / struct DoLint { LL | | @@ -93,7 +119,7 @@ LL | | } = help: remove the prefixes error: all fields have the same postfix: `type` - --> $DIR/struct_fields.rs:112:5 + --> $DIR/struct_fields.rs:127:5 | LL | / struct DoLintToo { LL | | @@ -105,5 +131,5 @@ LL | | } | = help: remove the postfixes -error: aborting due to 9 previous errors +error: aborting due to 11 previous errors