File tree Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -731,7 +731,7 @@ impl Cursor<'_> {
731731 n_end_hashes,
732732 possible_terminator_offset : None ,
733733 } ;
734- } else if n_end_hashes > 0 && n_end_hashes > max_hashes {
734+ } else if n_end_hashes > max_hashes {
735735 // Keep track of possible terminators to give a hint about where there might be
736736 // a missing terminator
737737 possible_terminator_offset =
Original file line number Diff line number Diff line change @@ -287,15 +287,14 @@ impl<'a> Parser<'a> {
287287 }
288288
289289 fn check_too_many_raw_str_terminators ( & mut self , err : & mut DiagnosticBuilder < ' _ > ) -> bool {
290- let prev_token_raw_str = match self . prev_token . kind {
291- TokenKind :: Literal ( Lit {
292- kind : LitKind :: StrRaw ( n) | LitKind :: ByteStrRaw ( n) , ..
293- } ) => Some ( n) ,
294- _ => None ,
295- } ;
296-
297- if let Some ( n_hashes) = prev_token_raw_str {
298- if self . token . kind == TokenKind :: Pound {
290+ match ( & self . prev_token . kind , & self . token . kind ) {
291+ (
292+ TokenKind :: Literal ( Lit {
293+ kind : LitKind :: StrRaw ( n_hashes) | LitKind :: ByteStrRaw ( n_hashes) ,
294+ ..
295+ } ) ,
296+ TokenKind :: Pound ,
297+ ) => {
299298 err. set_primary_message ( "too many `#` when terminating raw string" ) ;
300299 err. span_suggestion (
301300 self . token . span ,
@@ -304,10 +303,10 @@ impl<'a> Parser<'a> {
304303 Applicability :: MachineApplicable ,
305304 ) ;
306305 err. note ( & format ! ( "the raw string started with {} `#`s" , n_hashes) ) ;
307- return true ;
306+ true
308307 }
308+ _ => false ,
309309 }
310- false
311310 }
312311
313312 pub fn maybe_annotate_with_ascription (
You can’t perform that action at this time.
0 commit comments