rust-clippy/tests/ui/struct_fields.stderr
jonboh 8b02dac542 add lint for struct field names
side effect for `enum_variants`:
use .first() instead of .get(0) in enum_variants lint
move to_camel_case to str_util module
move module, enum and struct name repetitions check to a single file `item_name_repetitions`
rename enum_variants threshold config option
2023-10-18 19:20:08 +02:00

265 lines
6.4 KiB
Text

error: field name ends with the struct's name
--> $DIR/struct_fields.rs:10:5
|
LL | field_data1: u8,
| ^^^^^^^^^^^^^^^
|
= note: `-D clippy::struct-field-names` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::struct_field_names)]`
error: field name starts with the struct's name
--> $DIR/struct_fields.rs:20:5
|
LL | data2_field: u8,
| ^^^^^^^^^^^^^^^
error: all fields have the same postfix: `data`
--> $DIR/struct_fields.rs:25:1
|
LL | / struct StructData {
LL | |
LL | | movable_data: u8,
LL | | fixed_data: u8,
LL | | invisible_data: u8,
LL | | }
| |_^
|
= help: remove the postfixes
error: all fields have the same prefix: `data`
--> $DIR/struct_fields.rs:32:1
|
LL | / struct DataStruct {
LL | |
LL | | data_movable: u8,
LL | | data_fixed: u8,
LL | | data_invisible: u8,
LL | | }
| |_^
|
= help: remove the prefixes
error: all fields have the same prefix: `some_data`
--> $DIR/struct_fields.rs:39:1
|
LL | / struct DoublePrefix {
LL | |
LL | | some_data_a: bool,
LL | | some_data_b: bool,
LL | | some_data_c: bool,
LL | | }
| |_^
|
= help: remove the prefixes
error: all fields have the same postfix: `some_data`
--> $DIR/struct_fields.rs:46:1
|
LL | / struct DoublePostfix {
LL | |
LL | | a_some_data: bool,
LL | | b_some_data: bool,
LL | | c_some_data: bool,
LL | | }
| |_^
|
= help: remove the postfixes
error: all fields have the same postfix: `someData`
--> $DIR/struct_fields.rs:54: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:61: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:74:1
|
LL | / struct NonCaps {
LL | |
LL | | prefix_的: u8,
LL | | prefix_tea: u8,
LL | | prefix_cake: u8,
LL | | }
| |_^
|
= help: remove the prefixes
error: all fields have the same prefix: `_type`
--> $DIR/struct_fields.rs:124:5
|
LL | / struct DoLint {
LL | |
LL | | _type_create: u8,
LL | | _type_read: u8,
LL | | _type_update: u8,
LL | | _type_destroy: u8,
LL | | }
| |_____^
|
= help: remove the prefixes
error: all fields have the same prefix: `__type`
--> $DIR/struct_fields.rs:132:5
|
LL | / struct DoLint2 {
LL | |
LL | | __type_create: u8,
LL | | __type_read: u8,
LL | | __type_update: u8,
LL | | __type_destroy: u8,
LL | | }
| |_____^
|
= help: remove the prefixes
error: all fields have the same prefix: `___type`
--> $DIR/struct_fields.rs:140:5
|
LL | / struct DoLint3 {
LL | |
LL | | ___type_create: u8,
LL | | ___type_read: u8,
LL | | ___type_update: u8,
LL | | ___type_destroy: u8,
LL | | }
| |_____^
|
= help: remove the prefixes
error: all fields have the same postfix: `_`
--> $DIR/struct_fields.rs:148:5
|
LL | / struct DoLint4 {
LL | |
LL | | create_: u8,
LL | | read_: u8,
LL | | update_: u8,
LL | | destroy_: u8,
LL | | }
| |_____^
|
= help: remove the postfixes
error: all fields have the same postfix: `__`
--> $DIR/struct_fields.rs:156:5
|
LL | / struct DoLint5 {
LL | |
LL | | create__: u8,
LL | | read__: u8,
LL | | update__: u8,
LL | | destroy__: u8,
LL | | }
| |_____^
|
= help: remove the postfixes
error: all fields have the same postfix: `___`
--> $DIR/struct_fields.rs:164:5
|
LL | / struct DoLint6 {
LL | |
LL | | create___: u8,
LL | | read___: u8,
LL | | update___: u8,
LL | | destroy___: u8,
LL | | }
| |_____^
|
= help: remove the postfixes
error: all fields have the same postfix: `type`
--> $DIR/struct_fields.rs:172:5
|
LL | / struct DoLintToo {
LL | |
LL | | _create_type: u8,
LL | | _update_type: u8,
LL | | _delete_type: u8,
LL | | }
| |_____^
|
= help: remove the postfixes
error: field name starts with the struct's name
--> $DIR/struct_fields.rs:210:5
|
LL | proxy: i32,
| ^^^^^^^^^^
error: all fields have the same prefix: `some`
--> $DIR/struct_fields.rs:226:13
|
LL | / struct MacroStruct {
LL | | some_a: i32,
LL | | some_b: i32,
LL | | some_c: i32,
LL | | }
| |_____________^
...
LL | mk_struct!();
| ------------ in this macro invocation
|
= help: remove the prefixes
= note: this error originates in the macro `mk_struct` (in Nightly builds, run with -Z macro-backtrace for more info)
error: field name starts with the struct's name
--> $DIR/struct_fields.rs:239:17
|
LL | macrobaz_a: i32,
| ^^^^^^^^^^^^^^^
...
LL | mk_struct2!();
| ------------- in this macro invocation
|
= note: this error originates in the macro `mk_struct2` (in Nightly builds, run with -Z macro-backtrace for more info)
error: field name starts with the struct's name
--> $DIR/struct_fields.rs:251:17
|
LL | $field: i32,
| ^^^^^^^^^^^
...
LL | mk_struct_with_names!(Foo, foo);
| ------------------------------- in this macro invocation
|
= note: this error originates in the macro `mk_struct_with_names` (in Nightly builds, run with -Z macro-backtrace for more info)
error: all fields have the same prefix: `some`
--> $DIR/struct_fields.rs:291:13
|
LL | / struct $struct_name {
LL | | $field1: i32,
LL | | $field2: i32,
LL | | $field3: i32,
LL | | }
| |_____________^
...
LL | mk_struct_full_def!(PrefixData, some_data, some_meta, some_other);
| ----------------------------------------------------------------- in this macro invocation
|
= help: remove the prefixes
= note: this error originates in the macro `mk_struct_full_def` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 21 previous errors