From 2135331a3352fa81dcb8592daa435d7a32d93ca0 Mon Sep 17 00:00:00 2001 From: Takayuki Maeda Date: Fri, 17 Jun 2022 18:48:09 +0900 Subject: [PATCH] remove the rest of unnecessary `to_string` --- compiler/rustc_parse/src/parser/diagnostics.rs | 8 ++++---- src/tools/clippy/clippy_utils/src/sugg.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index c56f70e853daa..acf892cec5328 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -2042,9 +2042,9 @@ impl<'a> Parser<'a> { match pat.kind { PatKind::Ident(_, ident, _) => ( ident, - "self: ".to_string(), + "self: ", ": TypeName".to_string(), - "_: ".to_string(), + "_: ", pat.span.shrink_to_lo(), pat.span.shrink_to_hi(), pat.span.shrink_to_lo(), @@ -2058,9 +2058,9 @@ impl<'a> Parser<'a> { let mutab = mutab.prefix_str(); ( ident, - "self: ".to_string(), + "self: ", format!("{ident}: &{mutab}TypeName"), - "_: ".to_string(), + "_: ", pat.span.shrink_to_lo(), pat.span, pat.span.shrink_to_lo(), diff --git a/src/tools/clippy/clippy_utils/src/sugg.rs b/src/tools/clippy/clippy_utils/src/sugg.rs index 4d21ba8bd1d16..aa119539b1b39 100644 --- a/src/tools/clippy/clippy_utils/src/sugg.rs +++ b/src/tools/clippy/clippy_utils/src/sugg.rs @@ -771,7 +771,7 @@ impl DiagnosticExt for rustc_errors::Diagnostic { } } - self.span_suggestion(remove_span, msg, String::new(), applicability); + self.span_suggestion(remove_span, msg, "", applicability); } }