Suggest to add each of |
and ()
when unexpected ,
is found in pattern
This commit is contained in:
parent
d8a0dd7ae8
commit
62867b4992
2 changed files with 60 additions and 7 deletions
|
@ -4381,9 +4381,14 @@ impl<'a> Parser<'a> {
|
|||
if let Ok(seq_snippet) = self.sess.source_map().span_to_snippet(seq_span) {
|
||||
err.span_suggestion(
|
||||
seq_span,
|
||||
"try adding parentheses",
|
||||
"try adding parentheses to match on a tuple..",
|
||||
format!("({})", seq_snippet),
|
||||
Applicability::MachineApplicable
|
||||
).span_suggestion(
|
||||
seq_span,
|
||||
"..or a vertical bar to match on multiple alternatives",
|
||||
format!("{}", seq_snippet.replace(",", " |")),
|
||||
Applicability::MachineApplicable
|
||||
);
|
||||
}
|
||||
return Err(err);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue