File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed
compiler/rustc_parse/src/parser Expand file tree Collapse file tree 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> {
282282 pub fn parse_inner_attributes ( & mut self ) -> PResult < ' a , ast:: AttrVec > {
283283 let mut attrs = ast:: AttrVec :: new ( ) ;
284284 loop {
285- let start_pos: u32 = self . num_bump_calls . try_into ( ) . unwrap ( ) ;
285+ let start_pos = self . num_bump_calls ;
286286 // Only try to parse if it is an inner attribute (has `!`).
287287 let attr = if self . check ( & token:: Pound ) && self . look_ahead ( 1 , |t| t == & token:: Not ) {
288288 Some ( self . parse_attribute ( InnerAttrPolicy :: Permitted ) ?)
@@ -303,7 +303,7 @@ impl<'a> Parser<'a> {
303303 None
304304 } ;
305305 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 ;
307307 // If we are currently capturing tokens, mark the location of this inner attribute.
308308 // If capturing ends up creating a `LazyAttrTokenStream`, we will include
309309 // 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;
88use rustc_session:: parse:: ParseSess ;
99use rustc_span:: { sym, Span , DUMMY_SP } ;
1010
11- use std:: ops:: Range ;
1211use std:: { iter, mem} ;
1312
1413/// A wrapper type to ensure that the parser handles outer attributes correctly.
@@ -356,8 +355,7 @@ impl<'a> Parser<'a> {
356355 let new_tokens = vec ! [ ( FlatToken :: AttrTarget ( attr_data) , Spacing :: Alone ) ] ;
357356
358357 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) ) ;
361359 self . capture_state . replace_ranges . extend ( inner_attr_replace_ranges) ;
362360 }
363361
You can’t perform that action at this time.
0 commit comments