File tree 2 files changed +3
-5
lines changed
compiler/rustc_parse/src/parser
2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -282,7 +282,7 @@ impl<'a> Parser<'a> {
282
282
pub fn parse_inner_attributes ( & mut self ) -> PResult < ' a , ast:: AttrVec > {
283
283
let mut attrs = ast:: AttrVec :: new ( ) ;
284
284
loop {
285
- let start_pos: u32 = self . num_bump_calls . try_into ( ) . unwrap ( ) ;
285
+ let start_pos = self . num_bump_calls ;
286
286
// Only try to parse if it is an inner attribute (has `!`).
287
287
let attr = if self . check ( & token:: Pound ) && self . look_ahead ( 1 , |t| t == & token:: Not ) {
288
288
Some ( self . parse_attribute ( InnerAttrPolicy :: Permitted ) ?)
@@ -303,7 +303,7 @@ impl<'a> Parser<'a> {
303
303
None
304
304
} ;
305
305
if let Some ( attr) = attr {
306
- let end_pos: u32 = self . num_bump_calls . try_into ( ) . unwrap ( ) ;
306
+ let end_pos = self . num_bump_calls ;
307
307
// If we are currently capturing tokens, mark the location of this inner attribute.
308
308
// If capturing ends up creating a `LazyAttrTokenStream`, we will include
309
309
// this replace range with it, removing the inner attribute from the final
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ use rustc_errors::PResult;
8
8
use rustc_session:: parse:: ParseSess ;
9
9
use rustc_span:: { sym, Span , DUMMY_SP } ;
10
10
11
- use std:: ops:: Range ;
12
11
use std:: { iter, mem} ;
13
12
14
13
/// A wrapper type to ensure that the parser handles outer attributes correctly.
@@ -356,8 +355,7 @@ impl<'a> Parser<'a> {
356
355
let new_tokens = vec ! [ ( FlatToken :: AttrTarget ( attr_data) , Spacing :: Alone ) ] ;
357
356
358
357
assert ! ( !self . break_last_token, "Should not have unglued last token with cfg attr" ) ;
359
- let range: Range < u32 > = ( start_pos. try_into ( ) . unwrap ( ) ) ..( end_pos. try_into ( ) . unwrap ( ) ) ;
360
- self . capture_state . replace_ranges . push ( ( range, new_tokens) ) ;
358
+ self . capture_state . replace_ranges . push ( ( start_pos..end_pos, new_tokens) ) ;
361
359
self . capture_state . replace_ranges . extend ( inner_attr_replace_ranges) ;
362
360
}
363
361
You can’t perform that action at this time.
0 commit comments