reword the message to suggest surrounding with parentheses
This commit is contained in:
parent
3983881d4e
commit
e3071eaa60
4 changed files with 10 additions and 7 deletions
|
@ -751,7 +751,10 @@ impl SourceMap {
|
|||
f: impl Fn(char) -> bool,
|
||||
) -> Result<Span, SpanSnippetError> {
|
||||
self.span_to_source(span, |s, start, _end| {
|
||||
let n = s[..start].char_indices().rfind(|&(_, c)| !f(c)).map_or(start, |(i, _)| start - i - 1);
|
||||
let n = s[..start]
|
||||
.char_indices()
|
||||
.rfind(|&(_, c)| !f(c))
|
||||
.map_or(start, |(i, _)| start - i - 1);
|
||||
Ok(span.with_lo(span.lo() - BytePos(n as u32)))
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue