Add suggestion for underscore binding fix.
This commit emits a suggestion for adding an underscore binding to arguments in trait methods that previously did not have a argument name specified.
This commit is contained in:
parent
e4dc15a969
commit
7fcf31b181
2 changed files with 15 additions and 2 deletions
|
@ -1850,6 +1850,15 @@ impl<'a> Parser<'a> {
|
|||
Applicability::HasPlaceholders,
|
||||
);
|
||||
} else if require_name && is_trait_item {
|
||||
if let PatKind::Ident(_, ident, _) = pat.node {
|
||||
err.span_suggestion_with_applicability(
|
||||
pat.span,
|
||||
"explicitly ignore parameter",
|
||||
format!("_: {}", ident),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
|
||||
err.note("anonymous parameters are removed in the 2018 edition (see RFC 1685)");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue