mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-22 11:03:16 +00:00
76 lines
2.7 KiB
Text
76 lines
2.7 KiB
Text
|
error: field assignment outside of initializer for an instance created with Default::default()
|
||
|
--> $DIR/field_reassign_with_default.rs:30:5
|
||
|
|
|
||
|
LL | a.i = 42;
|
||
|
| ^^^^^^^^^
|
||
|
|
|
||
|
= note: `-D clippy::field-reassign-with-default` implied by `-D warnings`
|
||
|
note: consider initializing the variable with `A { i: 42, ..Default::default() }` and removing relevant reassignments
|
||
|
--> $DIR/field_reassign_with_default.rs:29:5
|
||
|
|
|
||
|
LL | let mut a: A = Default::default();
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
|
|
||
|
error: field assignment outside of initializer for an instance created with Default::default()
|
||
|
--> $DIR/field_reassign_with_default.rs:70:5
|
||
|
|
|
||
|
LL | a.j = 43;
|
||
|
| ^^^^^^^^^
|
||
|
|
|
||
|
note: consider initializing the variable with `A { j: 43, i: 42 }` and removing relevant reassignments
|
||
|
--> $DIR/field_reassign_with_default.rs:69:5
|
||
|
|
|
||
|
LL | let mut a: A = Default::default();
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
|
|
||
|
error: field assignment outside of initializer for an instance created with Default::default()
|
||
|
--> $DIR/field_reassign_with_default.rs:75:5
|
||
|
|
|
||
|
LL | a.i = 42;
|
||
|
| ^^^^^^^^^
|
||
|
|
|
||
|
note: consider initializing the variable with `A { i: 42, j: 44 }` and removing relevant reassignments
|
||
|
--> $DIR/field_reassign_with_default.rs:74:5
|
||
|
|
|
||
|
LL | let mut a: A = Default::default();
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
|
|
||
|
error: field assignment outside of initializer for an instance created with Default::default()
|
||
|
--> $DIR/field_reassign_with_default.rs:81:5
|
||
|
|
|
||
|
LL | a.i = 42;
|
||
|
| ^^^^^^^^^
|
||
|
|
|
||
|
note: consider initializing the variable with `A { i: 42, ..Default::default() }` and removing relevant reassignments
|
||
|
--> $DIR/field_reassign_with_default.rs:80:5
|
||
|
|
|
||
|
LL | let mut a = A::default();
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
|
|
||
|
error: field assignment outside of initializer for an instance created with Default::default()
|
||
|
--> $DIR/field_reassign_with_default.rs:91:5
|
||
|
|
|
||
|
LL | a.i = Default::default();
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
|
|
|
||
|
note: consider initializing the variable with `A::default()` and removing relevant reassignments
|
||
|
--> $DIR/field_reassign_with_default.rs:90:5
|
||
|
|
|
||
|
LL | let mut a: A = Default::default();
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
|
|
||
|
error: field assignment outside of initializer for an instance created with Default::default()
|
||
|
--> $DIR/field_reassign_with_default.rs:95:5
|
||
|
|
|
||
|
LL | a.i = Default::default();
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
|
|
|
||
|
note: consider initializing the variable with `A { j: 45, ..Default::default() }` and removing relevant reassignments
|
||
|
--> $DIR/field_reassign_with_default.rs:94:5
|
||
|
|
|
||
|
LL | let mut a: A = Default::default();
|
||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||
|
|
||
|
error: aborting due to 6 previous errors
|
||
|
|