Skip to content

Commit 51766b7

Browse files
author
Henri Lunnikivi
committed
Do not mention 'immutable' in suggestion
1 parent dbe78c3 commit 51766b7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

clippy_lints/src/field_reassign_with_default.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl LateLintPass<'_> for FieldReassignWithDefault {
8484
}
8585

8686
// if there are incorrectly assigned fields, do a span_lint_and_note to suggest
87-
// immutable construction using `Ty { fields, ..Default::default() }`
87+
// construction using `Ty { fields, ..Default::default() }`
8888
if !assigned_fields.is_empty() {
8989
// take the original assignment as span
9090
let stmt = &block.stmts[stmt_idx];
@@ -107,7 +107,7 @@ impl LateLintPass<'_> for FieldReassignWithDefault {
107107
first_assign.unwrap_or_else(|| unreachable!()).span,
108108
"field assignment outside of initializer for an instance created with Default::default()",
109109
Some(preceding_local.span),
110-
&format!("consider initializing the variable immutably with `{}`", sugg),
110+
&format!("consider initializing the variable with `{}`", sugg),
111111
);
112112
}
113113
}

tests/ui/field_reassign_with_default.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | a.i = 42;
55
| ^^^^^^^^^
66
|
77
= note: `-D clippy::field-reassign-with-default` implied by `-D warnings`
8-
note: consider initializing the variable immutably with `A { i: 42, ..Default::default() }`
8+
note: consider initializing the variable with `A { i: 42, ..Default::default() }`
99
--> $DIR/field_reassign_with_default.rs:16:5
1010
|
1111
LL | let mut a: A = Default::default();
@@ -17,7 +17,7 @@ error: field assignment outside of initializer for an instance created with Defa
1717
LL | a.i = 42;
1818
| ^^^^^^^^^
1919
|
20-
note: consider initializing the variable immutably with `A { i: 42, j: 43, ..Default::default() }`
20+
note: consider initializing the variable with `A { i: 42, j: 43, ..Default::default() }`
2121
--> $DIR/field_reassign_with_default.rs:56:5
2222
|
2323
LL | let mut a: A = Default::default();
@@ -29,7 +29,7 @@ error: field assignment outside of initializer for an instance created with Defa
2929
LL | a.i = 42;
3030
| ^^^^^^^^^
3131
|
32-
note: consider initializing the variable immutably with `A { i: 42, j: 43, ..Default::default() }`
32+
note: consider initializing the variable with `A { i: 42, j: 43, ..Default::default() }`
3333
--> $DIR/field_reassign_with_default.rs:61:5
3434
|
3535
LL | let mut a: A = Default::default();

0 commit comments

Comments
 (0)