File tree 2 files changed +11
-12
lines changed
2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -731,7 +731,7 @@ impl Cursor<'_> {
731
731
n_end_hashes,
732
732
possible_terminator_offset : None ,
733
733
} ;
734
- } else if n_end_hashes > 0 && n_end_hashes > max_hashes {
734
+ } else if n_end_hashes > max_hashes {
735
735
// Keep track of possible terminators to give a hint about where there might be
736
736
// a missing terminator
737
737
possible_terminator_offset =
Original file line number Diff line number Diff line change @@ -287,15 +287,14 @@ impl<'a> Parser<'a> {
287
287
}
288
288
289
289
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
+ ) => {
299
298
err. set_primary_message ( "too many `#` when terminating raw string" ) ;
300
299
err. span_suggestion (
301
300
self . token . span ,
@@ -304,10 +303,10 @@ impl<'a> Parser<'a> {
304
303
Applicability :: MachineApplicable ,
305
304
) ;
306
305
err. note ( & format ! ( "the raw string started with {} `#`s" , n_hashes) ) ;
307
- return true ;
306
+ true
308
307
}
308
+ _ => false ,
309
309
}
310
- false
311
310
}
312
311
313
312
pub fn maybe_annotate_with_ascription (
You can’t perform that action at this time.
0 commit comments