diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2025-02-08 22:12:13 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2025-02-08 22:12:13 +0000 |
| commit | 1fcae03369abb4c2cc180cd5a49e1f4440a81300 (patch) | |
| tree | fe705ff77c286f5fc4c09acc98d2f124086d0479 /compiler/rustc_parse/src/errors.rs | |
| parent | 3183b44a1ec209b06e0c26cbc92217176b59dc76 (diff) | |
| download | rust-1fcae03369abb4c2cc180cd5a49e1f4440a81300.tar.gz rust-1fcae03369abb4c2cc180cd5a49e1f4440a81300.zip | |
Rustfmt
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
| -rw-r--r-- | compiler/rustc_parse/src/errors.rs | 76 |
1 files changed, 44 insertions, 32 deletions
diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 2373ab67d42..8f0e29c2769 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -1121,23 +1121,29 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for ExpectedIdentifier { let token_descr = TokenDescription::from_token(&self.token); let mut add_token = true; - let mut diag = Diag::new(dcx, level, match token_descr { - Some(TokenDescription::ReservedIdentifier) => { - fluent::parse_expected_identifier_found_reserved_identifier_str - } - Some(TokenDescription::Keyword) => fluent::parse_expected_identifier_found_keyword_str, - Some(TokenDescription::ReservedKeyword) => { - fluent::parse_expected_identifier_found_reserved_keyword_str - } - Some(TokenDescription::DocComment) => { - fluent::parse_expected_identifier_found_doc_comment_str - } - Some(TokenDescription::MetaVar(_)) => { - add_token = false; - fluent::parse_expected_identifier_found_metavar_str - } - None => fluent::parse_expected_identifier_found_str, - }); + let mut diag = Diag::new( + dcx, + level, + match token_descr { + Some(TokenDescription::ReservedIdentifier) => { + fluent::parse_expected_identifier_found_reserved_identifier_str + } + Some(TokenDescription::Keyword) => { + fluent::parse_expected_identifier_found_keyword_str + } + Some(TokenDescription::ReservedKeyword) => { + fluent::parse_expected_identifier_found_reserved_keyword_str + } + Some(TokenDescription::DocComment) => { + fluent::parse_expected_identifier_found_doc_comment_str + } + Some(TokenDescription::MetaVar(_)) => { + add_token = false; + fluent::parse_expected_identifier_found_metavar_str + } + None => fluent::parse_expected_identifier_found_str, + }, + ); diag.span(self.span); if add_token { diag.arg("token", self.token); @@ -1182,21 +1188,27 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for ExpectedSemi { let token_descr = TokenDescription::from_token(&self.token); let mut add_token = true; - let mut diag = Diag::new(dcx, level, match token_descr { - Some(TokenDescription::ReservedIdentifier) => { - fluent::parse_expected_semi_found_reserved_identifier_str - } - Some(TokenDescription::Keyword) => fluent::parse_expected_semi_found_keyword_str, - Some(TokenDescription::ReservedKeyword) => { - fluent::parse_expected_semi_found_reserved_keyword_str - } - Some(TokenDescription::DocComment) => fluent::parse_expected_semi_found_doc_comment_str, - Some(TokenDescription::MetaVar(_)) => { - add_token = false; - fluent::parse_expected_semi_found_metavar_str - } - None => fluent::parse_expected_semi_found_str, - }); + let mut diag = Diag::new( + dcx, + level, + match token_descr { + Some(TokenDescription::ReservedIdentifier) => { + fluent::parse_expected_semi_found_reserved_identifier_str + } + Some(TokenDescription::Keyword) => fluent::parse_expected_semi_found_keyword_str, + Some(TokenDescription::ReservedKeyword) => { + fluent::parse_expected_semi_found_reserved_keyword_str + } + Some(TokenDescription::DocComment) => { + fluent::parse_expected_semi_found_doc_comment_str + } + Some(TokenDescription::MetaVar(_)) => { + add_token = false; + fluent::parse_expected_semi_found_metavar_str + } + None => fluent::parse_expected_semi_found_str, + }, + ); diag.span(self.span); if add_token { diag.arg("token", self.token); |
