avoid an unnecessary &str to String conversion

This commit is contained in:
Takayuki Maeda 2022-11-30 13:31:35 +09:00
parent 97f0c58b37
commit 02eaecc767

View File

@ -197,12 +197,12 @@ pub enum UnleashedFeatureHelp {
#[derive(Diagnostic)]
#[diag(session_invalid_literal_suffix)]
pub(crate) struct InvalidLiteralSuffix {
pub(crate) struct InvalidLiteralSuffix<'a> {
#[primary_span]
#[label]
pub span: Span,
// FIXME(#100717)
pub kind: String,
pub kind: &'a str,
pub suffix: Symbol,
}
@ -311,11 +311,7 @@ fn fix_base_capitalisation(s: &str) -> Option<String> {
LitError::LexerError => {}
LitError::InvalidSuffix => {
if let Some(suffix) = suffix {
sess.emit_err(InvalidLiteralSuffix {
span,
kind: format!("{}", kind.descr()),
suffix,
});
sess.emit_err(InvalidLiteralSuffix { span, kind: kind.descr(), suffix });
}
}
LitError::InvalidIntSuffix => {