Create a separate, tool-only suggestion for the comma
That way the comma isn't highlighted as part of the option in the UI. Weirdly, the comma removal suggestion shows up in the UI.
This commit is contained in:
parent
4ba66970d8
commit
8fe6710b4d
1 changed files with 9 additions and 5 deletions
|
|
@ -294,6 +294,14 @@ fn err_duplicate_option<'a>(p: &mut Parser<'a>, symbol: Symbol, span: Span) {
|
|||
String::new(),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
if p.look_ahead(0, |t| t == &token::Comma) {
|
||||
err.tool_only_span_suggestion(
|
||||
p.token.span,
|
||||
"remove this comma",
|
||||
String::new(),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
err.emit();
|
||||
}
|
||||
|
||||
|
|
@ -306,11 +314,7 @@ fn try_set_option<'a>(
|
|||
if !args.options.contains(option) {
|
||||
args.options |= option;
|
||||
} else {
|
||||
let mut span = p.prev_token.span;
|
||||
if p.look_ahead(0, |t| t == &token::Comma) {
|
||||
span = span.to(p.token.span);
|
||||
}
|
||||
err_duplicate_option(p, symbol, span);
|
||||
err_duplicate_option(p, symbol, p.prev_token.span);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue