Added a help span which informs the user about the escaping of curly braces in a format string if a wrongly escaped one is detected in a string.
This commit is contained in:
@@ -843,13 +843,19 @@ impl<'a> StringReader<'a> {
|
||||
if ascii_only { "unknown byte escape" }
|
||||
else { "unknown character escape" },
|
||||
c);
|
||||
let sp = codemap::mk_sp(escaped_pos, last_pos);
|
||||
if e == '\r' {
|
||||
let sp = codemap::mk_sp(escaped_pos, last_pos);
|
||||
self.span_diagnostic.span_help(
|
||||
sp,
|
||||
"this is an isolated carriage return; consider checking \
|
||||
your editor and version control settings")
|
||||
}
|
||||
if (e == '{' || e == '}') && !ascii_only {
|
||||
self.span_diagnostic.span_help(
|
||||
sp,
|
||||
"if used in a formatting string, \
|
||||
curly braces are escaped with `{{` and `}}`")
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user