about summary refs log tree commit diff
path: root/src/librustc_parse/parser
diff options
context:
space:
mode:
authorRussell Cohen <russell.r.cohen@gmail.com>2020-03-29 11:12:48 -0400
committerRussell Cohen <russell.r.cohen@gmail.com>2020-03-29 11:12:48 -0400
commitc15f86b4b35a260b105dc472fc6e3556af8a8db0 (patch)
treee443a3ca5dcb215a8ff27887c5cb19da2b83201d /src/librustc_parse/parser
parent629e97a5a02edb3d8dc63c5157962c093217d441 (diff)
Cleanup error messages, improve docstrings
Diffstat (limited to 'src/librustc_parse/parser')
-rw-r--r--src/librustc_parse/parser/diagnostics.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/librustc_parse/parser/diagnostics.rs b/src/librustc_parse/parser/diagnostics.rs
index 7b6840307cb..2fc20e15c5a 100644
--- a/src/librustc_parse/parser/diagnostics.rs
+++ b/src/librustc_parse/parser/diagnostics.rs
@@ -288,9 +288,12 @@ impl<'a> Parser<'a> {
 
     fn check_too_many_raw_str_terminators(&mut self, err: &mut DiagnosticBuilder<'_>) -> bool {
         let prev_token_raw_str = match self.prev_token {
-            Token { kind: TokenKind::Literal(Lit { kind: LitKind::StrRaw(n), .. }), .. } => Some(n),
             Token {
-                kind: TokenKind::Literal(Lit { kind: LitKind::ByteStrRaw(n), .. }), ..
+                kind:
+                    TokenKind::Literal(Lit {
+                        kind: LitKind::StrRaw(n) | LitKind::ByteStrRaw(n), ..
+                    }),
+                ..
             } => Some(n),
             _ => None,
         };
@@ -300,11 +303,11 @@ impl<'a> Parser<'a> {
                 err.set_primary_message("too many `#` when terminating raw string");
                 err.span_suggestion(
                     self.token.span,
-                    "Remove the extra `#`",
+                    "remove the extra `#`",
                     String::new(),
                     Applicability::MachineApplicable,
                 );
-                err.note(&format!("The raw string started with {} `#`s", n_hashes));
+                err.note(&format!("the raw string started with {} `#`s", n_hashes));
                 return true;
             }
         }