Rollup merge of #102922 - kper:bugfix/102902-filtering-json, r=oli-obk
Filtering spans when emitting json According to the issue #102902, we shouldn't emit spans which have an empty span and no suggested replacement.
This commit is contained in:
commit
0a0e9f73af
8 changed files with 81 additions and 117 deletions
|
@ -1374,9 +1374,17 @@ impl<'a> Parser<'a> {
|
|||
kind: IncDecRecovery,
|
||||
(pre_span, post_span): (Span, Span),
|
||||
) -> MultiSugg {
|
||||
let mut patches = Vec::new();
|
||||
|
||||
if !pre_span.is_empty() {
|
||||
patches.push((pre_span, String::new()));
|
||||
}
|
||||
|
||||
patches.push((post_span, format!(" {}= 1", kind.op.chr())));
|
||||
|
||||
MultiSugg {
|
||||
msg: format!("use `{}= 1` instead", kind.op.chr()),
|
||||
patches: vec![(pre_span, String::new()), (post_span, format!(" {}= 1", kind.op.chr()))],
|
||||
patches,
|
||||
applicability: Applicability::MachineApplicable,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue