Skip to content

Commit 19f4905

Browse files
committed
x fmt
1 parent 8d15d4a commit 19f4905

File tree

2 files changed

+21
-24
lines changed

2 files changed

+21
-24
lines changed

compiler/rustc_parse/src/errors.rs

-1
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,6 @@ impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for ExpectedIdentifier {
953953
sugg.add_to_diagnostic(&mut diag);
954954
}
955955

956-
957956
ExpectedIdentifierFound::new(token_descr, self.span).add_to_diagnostic(&mut diag);
958957

959958
if let Some(sugg) = self.suggest_remove_comma {

compiler/rustc_parse/src/parser/diagnostics.rs

+21-23
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use crate::errors::{
1212
IncorrectAwait, IncorrectSemicolon, IncorrectUseOfAwait, ParenthesesInForHead,
1313
ParenthesesInForHeadSugg, PatternMethodParamWithoutBody, QuestionMarkInType,
1414
QuestionMarkInTypeSugg, SelfParamNotFirst, StructLiteralBodyWithoutPath,
15-
StructLiteralBodyWithoutPathSugg, SuggEscapeToUseAsIdentifier,
16-
SuggRemoveComma, UnexpectedConstInGenericParam, UnexpectedConstParamDeclaration,
15+
StructLiteralBodyWithoutPathSugg, SuggEscapeToUseAsIdentifier, SuggRemoveComma,
16+
UnexpectedConstInGenericParam, UnexpectedConstParamDeclaration,
1717
UnexpectedConstParamDeclarationSugg, UnmatchedAngleBrackets, UseEqInstead,
1818
};
1919

@@ -328,7 +328,7 @@ impl<'a> Parser<'a> {
328328

329329
// FIXME: shreys write better rust
330330
let err = ExpectedIdentifier {
331-
span: self.token.span ,
331+
span: self.token.span,
332332
token: self.token.clone(),
333333
suggest_raw,
334334
suggest_remove_comma,
@@ -337,30 +337,28 @@ impl<'a> Parser<'a> {
337337

338338
if self.token == token::Lt {
339339
// HACK: shreys shut the compiler up about unused result
340-
let _ = self.parse_generics()
341-
.map(|generic| {
342-
// at this point, token should be Ident with the fn name
340+
let _ = self.parse_generics().map(|generic| {
341+
// at this point, token should be Ident with the fn name
343342

344-
// FIXME: shreys the span should be the span of where the gneeric SHOULD go.
345-
// TODO: shreys what does this look like with invalid generic
346-
// TODO: shreys - what to do if no snippet? probably just HELP not suggestion
343+
// FIXME: shreys the span should be the span of where the gneeric SHOULD go.
344+
// TODO: shreys what does this look like with invalid generic
345+
// TODO: shreys - what to do if no snippet? probably just HELP not suggestion
347346

348-
let snippet = match self.sess.source_map().span_to_snippet(generic.span) {
349-
Ok(snippet) => snippet,
350-
_ => "".to_string()
351-
};
352-
353-
err.span_suggestion(
354-
self.token.span.to(generic.span.shrink_to_hi()),
355-
"help: place the generic parameter list after the function name:",
356-
snippet,
357-
Applicability::MachineApplicable
358-
);
359-
});
360-
}
347+
let snippet = match self.sess.source_map().span_to_snippet(generic.span) {
348+
Ok(snippet) => snippet,
349+
_ => "".to_string(),
350+
};
361351

362-
err
352+
err.span_suggestion(
353+
self.token.span.to(generic.span.shrink_to_hi()),
354+
"help: place the generic parameter list after the function name:",
355+
snippet,
356+
Applicability::MachineApplicable,
357+
);
358+
});
359+
}
363360

361+
err
364362
}
365363

366364
pub(super) fn expected_one_of_not_found(

0 commit comments

Comments
 (0)