Skip to content

Commit

Permalink
unneeded-field-pattern: make lint adhere to lint message convention
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiaskrgr committed Aug 10, 2020
1 parent 2792260 commit 4418ff1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions clippy_lints/src/misc_early.rs
Expand Up @@ -298,9 +298,9 @@ impl EarlyLintPass for MiscEarlyLints {
cx,
UNNEEDED_FIELD_PATTERN,
pat.span,
"All the struct fields are matched to a wildcard pattern, consider using `..`.",
"all the struct fields are matched to a wildcard pattern, consider using `..`",
None,
&format!("Try with `{} {{ .. }}` instead", type_name),
&format!("try with `{} {{ .. }}` instead", type_name),
);
return;
}
Expand All @@ -313,7 +313,7 @@ impl EarlyLintPass for MiscEarlyLints {
cx,
UNNEEDED_FIELD_PATTERN,
field.span,
"You matched a field with a wildcard pattern. Consider using `..` instead",
"you matched a field with a wildcard pattern, consider using `..` instead",
);
} else {
let mut normal = vec![];
Expand All @@ -333,10 +333,10 @@ impl EarlyLintPass for MiscEarlyLints {
cx,
UNNEEDED_FIELD_PATTERN,
field.span,
"You matched a field with a wildcard pattern. Consider using `..` \
"you matched a field with a wildcard pattern, consider using `..` \
instead",
None,
&format!("Try with `{} {{ {}, .. }}`", type_name, normal[..].join(", ")),
&format!("try with `{} {{ {}, .. }}`", type_name, normal[..].join(", ")),
);
}
}
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/unneeded_field_pattern.stderr
@@ -1,19 +1,19 @@
error: You matched a field with a wildcard pattern. Consider using `..` instead
error: you matched a field with a wildcard pattern, consider using `..` instead
--> $DIR/unneeded_field_pattern.rs:14:15
|
LL | Foo { a: _, b: 0, .. } => {},
| ^^^^
|
= note: `-D clippy::unneeded-field-pattern` implied by `-D warnings`
= help: Try with `Foo { b: 0, .. }`
= help: try with `Foo { b: 0, .. }`

error: All the struct fields are matched to a wildcard pattern, consider using `..`.
error: all the struct fields are matched to a wildcard pattern, consider using `..`
--> $DIR/unneeded_field_pattern.rs:16:9
|
LL | Foo { a: _, b: _, c: _ } => {},
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: Try with `Foo { .. }` instead
= help: try with `Foo { .. }` instead

error: aborting due to 2 previous errors

0 comments on commit 4418ff1

Please sign in to comment.