avoid an unnecessary &str
to String
conversion
This commit is contained in:
parent
97f0c58b37
commit
02eaecc767
1 changed files with 3 additions and 7 deletions
|
@ -197,12 +197,12 @@ pub enum UnleashedFeatureHelp {
|
||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(session_invalid_literal_suffix)]
|
#[diag(session_invalid_literal_suffix)]
|
||||||
pub(crate) struct InvalidLiteralSuffix {
|
pub(crate) struct InvalidLiteralSuffix<'a> {
|
||||||
#[primary_span]
|
#[primary_span]
|
||||||
#[label]
|
#[label]
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
// FIXME(#100717)
|
// FIXME(#100717)
|
||||||
pub kind: String,
|
pub kind: &'a str,
|
||||||
pub suffix: Symbol,
|
pub suffix: Symbol,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,11 +311,7 @@ pub fn report_lit_error(sess: &ParseSess, err: LitError, lit: token::Lit, span:
|
||||||
LitError::LexerError => {}
|
LitError::LexerError => {}
|
||||||
LitError::InvalidSuffix => {
|
LitError::InvalidSuffix => {
|
||||||
if let Some(suffix) = suffix {
|
if let Some(suffix) = suffix {
|
||||||
sess.emit_err(InvalidLiteralSuffix {
|
sess.emit_err(InvalidLiteralSuffix { span, kind: kind.descr(), suffix });
|
||||||
span,
|
|
||||||
kind: format!("{}", kind.descr()),
|
|
||||||
suffix,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LitError::InvalidIntSuffix => {
|
LitError::InvalidIntSuffix => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue