@@ -61,15 +61,15 @@ impl Preprocessor<SolcCompiler> for TestOptimizerPreprocessor {
6161 fn preprocess (
6262 & self ,
6363 _solc : & SolcCompiler ,
64- mut input : SolcVersionedInput ,
64+ input : & mut SolcVersionedInput ,
6565 paths : & ProjectPathsConfig < SolcLanguage > ,
6666 mocks : & mut HashSet < PathBuf > ,
67- ) -> Result < SolcVersionedInput > {
67+ ) -> Result < ( ) > {
6868 let sources = & mut input. input . sources ;
6969 // Skip if we are not preprocessing any tests or scripts. Avoids unnecessary AST parsing.
7070 if sources. iter ( ) . all ( |( path, _) | !is_test_or_script ( path, paths) ) {
7171 trace ! ( "no tests or sources to preprocess" ) ;
72- return Ok ( input ) ;
72+ return Ok ( ( ) ) ;
7373 }
7474
7575 let sess = Session :: builder ( ) . with_buffer_emitter ( Default :: default ( ) ) . build ( ) ;
@@ -123,30 +123,25 @@ impl Preprocessor<SolcCompiler> for TestOptimizerPreprocessor {
123123 return Err ( SolcError :: Message ( err. to_string ( ) ) ) ;
124124 }
125125
126- Ok ( input )
126+ Ok ( ( ) )
127127 }
128128}
129129
130130impl Preprocessor < MultiCompiler > for TestOptimizerPreprocessor {
131131 fn preprocess (
132132 & self ,
133133 compiler : & MultiCompiler ,
134- input : <MultiCompiler as Compiler >:: Input ,
134+ input : & mut <MultiCompiler as Compiler >:: Input ,
135135 paths : & ProjectPathsConfig < MultiCompilerLanguage > ,
136136 mocks : & mut HashSet < PathBuf > ,
137- ) -> Result < <MultiCompiler as Compiler >:: Input > {
138- match input {
139- MultiCompilerInput :: Solc ( input) => {
140- if let Some ( solc) = & compiler. solc {
141- let paths = paths. clone ( ) . with_language :: < SolcLanguage > ( ) ;
142- let input = self . preprocess ( solc, input, & paths, mocks) ?;
143- Ok ( MultiCompilerInput :: Solc ( input) )
144- } else {
145- Ok ( MultiCompilerInput :: Solc ( input) )
146- }
147- }
148- MultiCompilerInput :: Vyper ( input) => Ok ( MultiCompilerInput :: Vyper ( input) ) ,
149- }
137+ ) -> Result < ( ) > {
138+ // Preprocess only Solc compilers.
139+ let MultiCompilerInput :: Solc ( input) = input else { return Ok ( ( ) ) } ;
140+
141+ let Some ( solc) = & compiler. solc else { return Ok ( ( ) ) } ;
142+
143+ let paths = paths. clone ( ) . with_language :: < SolcLanguage > ( ) ;
144+ self . preprocess ( solc, input, & paths, mocks)
150145 }
151146}
152147
0 commit comments