File tree Expand file tree Collapse file tree 2 files changed +2
-8
lines changed Expand file tree Collapse file tree 2 files changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -165,12 +165,6 @@ impl LateLintPass<'_> for Default {
165165 let stmt = & block. stmts [ stmt_idx] ;
166166
167167 if let StmtKind :: Local ( preceding_local) = & stmt. kind {
168- // filter out fields like `= Default::default()`, because the FRU already covers them
169- let assigned_fields = assigned_fields
170- . into_iter ( )
171- . filter ( |( _, rhs) | !is_expr_default ( rhs, cx) )
172- . collect :: < Vec < ( Symbol , & Expr < ' _ > ) > > ( ) ;
173-
174168 // if all fields of the struct are not assigned, add `.. Default::default()` to the suggestion.
175169 let ext_with_default = !fields_of_type ( binding_type)
176170 . iter ( )
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ error: field assignment outside of initializer for an instance created with Defa
5353LL | a.i = Default::default();
5454 | ^^^^^^^^^^^^^^^^^^^^^^^^^
5555 |
56- note: consider initializing the variable with `A:: default()` and removing relevant reassignments
56+ note: consider initializing the variable with `A { i: Default:: default(), ..Default::default() } ` and removing relevant reassignments
5757 --> $DIR/field_reassign_with_default.rs:90:5
5858 |
5959LL | let mut a: A = Default::default();
@@ -65,7 +65,7 @@ error: field assignment outside of initializer for an instance created with Defa
6565LL | a.i = Default::default();
6666 | ^^^^^^^^^^^^^^^^^^^^^^^^^
6767 |
68- note: consider initializing the variable with `A { j: 45, .. Default::default() }` and removing relevant reassignments
68+ note: consider initializing the variable with `A { i: Default::default(), j: 45 }` and removing relevant reassignments
6969 --> $DIR/field_reassign_with_default.rs:94:5
7070 |
7171LL | let mut a: A = Default::default();
You can’t perform that action at this time.
0 commit comments