-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
field_reassign_with_default: don't expand macros in suggestion
- Loading branch information
1 parent
60919e4
commit 5d48b91
Showing
3 changed files
with
38 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,87 @@ | ||
error: field assignment outside of initializer for an instance created with Default::default() | ||
--> $DIR/field_reassign_with_default.rs:30:5 | ||
--> $DIR/field_reassign_with_default.rs:35: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 | ||
--> $DIR/field_reassign_with_default.rs:34: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 | ||
--> $DIR/field_reassign_with_default.rs:75: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 | ||
--> $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:75:5 | ||
--> $DIR/field_reassign_with_default.rs:80: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 | ||
--> $DIR/field_reassign_with_default.rs:79: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 | ||
--> $DIR/field_reassign_with_default.rs:86: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 | ||
--> $DIR/field_reassign_with_default.rs:85: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 | ||
--> $DIR/field_reassign_with_default.rs:96:5 | ||
| | ||
LL | a.i = Default::default(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: consider initializing the variable with `A { i: Default::default(), ..Default::default() }` and removing relevant reassignments | ||
--> $DIR/field_reassign_with_default.rs:90:5 | ||
--> $DIR/field_reassign_with_default.rs:95: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 | ||
--> $DIR/field_reassign_with_default.rs:100:5 | ||
| | ||
LL | a.i = Default::default(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: consider initializing the variable with `A { i: Default::default(), j: 45 }` and removing relevant reassignments | ||
--> $DIR/field_reassign_with_default.rs:94:5 | ||
--> $DIR/field_reassign_with_default.rs:99:5 | ||
| | ||
LL | let mut a: A = Default::default(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 6 previous errors | ||
error: field assignment outside of initializer for an instance created with Default::default() | ||
--> $DIR/field_reassign_with_default.rs:122:5 | ||
| | ||
LL | a.i = vec![1]; | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
note: consider initializing the variable with `C { i: vec![1], ..Default::default() }` and removing relevant reassignments | ||
--> $DIR/field_reassign_with_default.rs:121:5 | ||
| | ||
LL | let mut a: C = C::default(); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 7 previous errors | ||
|