diff options
| author | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-11-30 13:31:35 +0900 |
|---|---|---|
| committer | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-11-30 13:31:35 +0900 |
| commit | 02eaecc767b5f8deb1f1e3ddc7c0a793b6e7ff2d (patch) | |
| tree | 24877a3e28afcc378d51945cac3f1b45249438b2 | |
| parent | 97f0c58b37ba7e1bd32ddf1c4558884302f68194 (diff) | |
| download | rust-02eaecc767b5f8deb1f1e3ddc7c0a793b6e7ff2d.tar.gz rust-02eaecc767b5f8deb1f1e3ddc7c0a793b6e7ff2d.zip | |
avoid an unnecessary `&str` to `String` conversion
| -rw-r--r-- | compiler/rustc_session/src/errors.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/compiler/rustc_session/src/errors.rs b/compiler/rustc_session/src/errors.rs index 2f7055e3cc5..9aa8a06c6d3 100644 --- a/compiler/rustc_session/src/errors.rs +++ b/compiler/rustc_session/src/errors.rs @@ -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 @@ pub fn report_lit_error(sess: &ParseSess, err: LitError, lit: token::Lit, span: 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 => { |
