File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
crates/artifacts/solc/src Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -556,20 +556,25 @@ enum State {
556556
557557impl State {
558558 fn advance ( & mut self , pos : usize ) -> Result < ( ) , SyntaxError > {
559- match self {
560- Self :: Offset => * self = Self :: Length ,
561- Self :: Length => * self = Self :: Index ,
562- Self :: Index => * self = Self :: Jmp ,
563- Self :: Jmp => * self = Self :: Modifier ,
559+ * self = match self {
560+ Self :: Offset => Self :: Length ,
561+ Self :: Length => Self :: Index ,
562+ Self :: Index => Self :: Jmp ,
563+ Self :: Jmp => Self :: Modifier ,
564564 Self :: Modifier => return Err ( SyntaxError :: new ( pos, "unexpected colon" ) ) ,
565- }
565+ } ;
566566 Ok ( ( ) )
567567 }
568568}
569569
570- /// Parses a source map
570+ /// Parses a source map.
571571pub fn parse ( input : & str ) -> Result < SourceMap , SyntaxError > {
572- Parser :: new ( input) . collect ( )
572+ let mut source_map = Vec :: new ( ) ;
573+ for item in Parser :: new ( input) {
574+ source_map. push ( item?) ;
575+ }
576+ source_map. shrink_to_fit ( ) ;
577+ Ok ( source_map)
573578}
574579
575580#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments