Skip to content

Commit 5287004

Browse files
spanishpearTaKO8Ki
andcommitted
Apply automatic suggestions from code review
Co-authored-by: Takayuki Maeda <[email protected]>
1 parent e813132 commit 5287004

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/rustc_parse/src/parser/diagnostics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ impl<'a> Parser<'a> {
345345
match self.parse_generics() {
346346
Ok(generic) => {
347347
if let TokenKind::Ident(symbol, _) = maybe_keyword.kind {
348-
let ident_name = symbol.to_string();
348+
let ident_name = symbol;
349349
// at this point, we've found something like
350350
// `fn <T>id`
351351
// and current token should be Ident with the item name (i.e. the function name)
@@ -355,9 +355,9 @@ impl<'a> Parser<'a> {
355355
let Ok(snippet) = self.sess.source_map().span_to_snippet(generic.span) &&
356356
let Ok(ident) = self.sess.source_map().span_to_snippet(self.token.span) {
357357
err.span_suggestion_verbose(
358-
generic.span.to(self.token.span),
358+
self.token.span.shrink_to_hi(),
359359
format!("place the generic parameter name after the {ident_name} name"),
360-
format!(" {ident}{snippet}"),
360+
snippet,
361361
Applicability::MachineApplicable,
362362
);
363363
} else {

0 commit comments

Comments
 (0)