diff options
| author | Shrey Sudhir <shrey.somaiya@gmail.com> | 2022-12-02 00:40:33 +1100 |
|---|---|---|
| committer | SpanishPear <shrey.somaiya@gmail.com> | 2023-01-22 17:05:37 +1100 |
| commit | 5287004aa4f9b0685197cc0c009237812fed7047 (patch) | |
| tree | 28e3856627c667e1e160c7ec1fc2784f2c03fa92 /compiler/rustc_parse/src/parser | |
| parent | e813132e4f8b0c469c9959c2efa1b0629067b3b8 (diff) | |
| download | rust-5287004aa4f9b0685197cc0c009237812fed7047.tar.gz rust-5287004aa4f9b0685197cc0c009237812fed7047.zip | |
Apply automatic suggestions from code review
Co-authored-by: Takayuki Maeda <takoyaki0316@gmail.com>
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/diagnostics.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 6df9cfd3ff4..1e1e804c0d3 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -345,7 +345,7 @@ impl<'a> Parser<'a> { match self.parse_generics() { Ok(generic) => { if let TokenKind::Ident(symbol, _) = maybe_keyword.kind { - let ident_name = symbol.to_string(); + let ident_name = symbol; // at this point, we've found something like // `fn <T>id` // and current token should be Ident with the item name (i.e. the function name) @@ -355,9 +355,9 @@ impl<'a> Parser<'a> { let Ok(snippet) = self.sess.source_map().span_to_snippet(generic.span) && let Ok(ident) = self.sess.source_map().span_to_snippet(self.token.span) { err.span_suggestion_verbose( - generic.span.to(self.token.span), + self.token.span.shrink_to_hi(), format!("place the generic parameter name after the {ident_name} name"), - format!(" {ident}{snippet}"), + snippet, Applicability::MachineApplicable, ); } else { |
