File tree Expand file tree Collapse file tree 2 files changed +12
-9
lines changed
compilers/src/compilers/solc Expand file tree Collapse file tree 2 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -556,20 +556,23 @@ 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+ Parser :: new ( input) . collect :: < Result < SourceMap , SyntaxError > > ( ) . map ( |mut v| {
573+ v. shrink_to_fit ( ) ;
574+ v
575+ } )
573576}
574577
575578#[ cfg( test) ]
Original file line number Diff line number Diff line change @@ -615,7 +615,7 @@ fn version_from_output(output: Output) -> Result<Version> {
615615 let version = stdout
616616 . lines ( )
617617 . filter ( |l| !l. trim ( ) . is_empty ( ) )
618- . last ( )
618+ . next_back ( )
619619 . ok_or_else ( || SolcError :: msg ( "Version not found in Solc output" ) ) ?;
620620 // NOTE: semver doesn't like `+` in g++ in build metadata which is invalid semver
621621 Ok ( Version :: from_str ( & version. trim_start_matches ( "Version: " ) . replace ( ".g++" , ".gcc" ) ) ?)
You can’t perform that action at this time.
0 commit comments