diff options
| author | yukang <moorekang@gmail.com> | 2023-06-06 23:56:46 +0800 |
|---|---|---|
| committer | yukang <moorekang@gmail.com> | 2023-06-10 06:28:35 +0800 |
| commit | e3071eaa608301bd4106c304e3c2f433d6507500 (patch) | |
| tree | 6e092f3f1122713954c43d5939ff06a7377742c9 /compiler/rustc_span/src/source_map.rs | |
| parent | 3983881d4e00c2b12d1b5b0319b4c61d72926917 (diff) | |
| download | rust-e3071eaa608301bd4106c304e3c2f433d6507500.tar.gz rust-e3071eaa608301bd4106c304e3c2f433d6507500.zip | |
reword the message to suggest surrounding with parentheses
Diffstat (limited to 'compiler/rustc_span/src/source_map.rs')
| -rw-r--r-- | compiler/rustc_span/src/source_map.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs index f354751112f..c53fe084c4d 100644 --- a/compiler/rustc_span/src/source_map.rs +++ b/compiler/rustc_span/src/source_map.rs @@ -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))) }) } |
