Use shorter span for existing '
-> "
structured suggestion
This commit is contained in:
parent
982918f493
commit
4a10b01f95
14 changed files with 51 additions and 41 deletions
|
@ -95,11 +95,21 @@ pub(crate) fn emit_unescape_error(
|
|||
}
|
||||
escaped.push(c);
|
||||
}
|
||||
let sugg = format!("{prefix}\"{escaped}\"");
|
||||
MoreThanOneCharSugg::Quotes {
|
||||
span: full_lit_span,
|
||||
is_byte: mode == Mode::Byte,
|
||||
sugg,
|
||||
if escaped.len() != lit.len() {
|
||||
let sugg = format!("{prefix}\"{escaped}\"");
|
||||
MoreThanOneCharSugg::QuotesFull {
|
||||
span: full_lit_span,
|
||||
is_byte: mode == Mode::Byte,
|
||||
sugg,
|
||||
}
|
||||
} else {
|
||||
MoreThanOneCharSugg::Quotes {
|
||||
start: full_lit_span
|
||||
.with_hi(full_lit_span.lo() + BytePos((prefix.len() + 1) as u32)),
|
||||
end: full_lit_span.with_lo(full_lit_span.hi() - BytePos(1)),
|
||||
is_byte: mode == Mode::Byte,
|
||||
prefix,
|
||||
}
|
||||
}
|
||||
});
|
||||
dcx.emit_err(UnescapeError::MoreThanOneChar {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue