File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -607,12 +607,13 @@ impl<'a> TreeSink for TtTreeSink<'a> {
607607 let text: SmolStr = match self . cursor . token_tree ( ) {
608608 Some ( tt:: TokenTree :: Leaf ( leaf) ) => {
609609 // Mark the range if needed
610- let id = match leaf {
611- tt:: Leaf :: Ident ( ident) => ident. id ,
612- tt:: Leaf :: Punct ( punct) => punct. id ,
613- tt:: Leaf :: Literal ( lit) => lit. id ,
610+ let ( text, id) = match leaf {
611+ tt:: Leaf :: Ident ( ident) => ( ident. text . clone ( ) , ident. id ) ,
612+ tt:: Leaf :: Punct ( punct) => {
613+ ( SmolStr :: new_inline_from_ascii ( 1 , & [ punct. char as u8 ] ) , punct. id )
614+ }
615+ tt:: Leaf :: Literal ( lit) => ( lit. text . clone ( ) , lit. id ) ,
614616 } ;
615- let text = SmolStr :: new ( format ! ( "{}" , leaf) ) ;
616617 let range = TextRange :: offset_len ( self . text_pos , TextUnit :: of_str ( & text) ) ;
617618 self . token_map . insert ( id, range) ;
618619 self . cursor = self . cursor . bump ( ) ;
You can’t perform that action at this time.
0 commit comments