1
Fork 0

use smaller span for suggestions

This commit is contained in:
Takayuki Maeda 2022-08-27 02:23:21 +09:00
parent 9845f4c47e
commit b33c3d6cd6
10 changed files with 35 additions and 33 deletions

View file

@ -223,14 +223,12 @@ impl<'a> SessionDiagnostic<'a> for UnsupportedLiteral {
error_code!(E0565),
);
if self.is_bytestr {
if let Ok(lint_str) = sess.source_map().span_to_snippet(self.span) {
diag.span_suggestion(
self.span,
fluent::attr::unsupported_literal_suggestion,
&lint_str[1..],
Applicability::MaybeIncorrect,
);
}
diag.span_suggestion(
sess.source_map().start_point(self.span),
fluent::attr::unsupported_literal_suggestion,
"",
Applicability::MaybeIncorrect,
);
}
diag
}