File tree Expand file tree Collapse file tree 4 files changed +10
-7
lines changed Expand file tree Collapse file tree 4 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -266,8 +266,8 @@ impl Provider for CoreBuildArgs {
266266 dict. insert ( "ast" . to_string ( ) , true . into ( ) ) ;
267267 }
268268
269- if self . compiler . optimize {
270- dict. insert ( "optimizer" . to_string ( ) , self . compiler . optimize . into ( ) ) ;
269+ if let Some ( optimize ) = self . compiler . optimize {
270+ dict. insert ( "optimizer" . to_string ( ) , optimize. into ( ) ) ;
271271 }
272272
273273 if !self . compiler . extra_output . is_empty ( ) {
Original file line number Diff line number Diff line change @@ -26,9 +26,9 @@ pub struct CompilerArgs {
2626 pub evm_version : Option < EvmVersion > ,
2727
2828 /// Activate the Solidity optimizer.
29- #[ arg( long) ]
29+ #[ arg( long, default_missing_value= "true" , num_args = 0 ..= 1 ) ]
3030 #[ serde( skip) ]
31- pub optimize : bool ,
31+ pub optimize : Option < bool > ,
3232
3333 /// The number of runs specifies roughly how often each opcode of the deployed code will be
3434 /// executed across the life-time of the contract. This means it is a trade-off parameter
Original file line number Diff line number Diff line change @@ -335,8 +335,11 @@ impl CreateArgs {
335335
336336 println ! ( "Starting contract verification..." ) ;
337337
338- let num_of_optimizations =
339- if self . opts . compiler . optimize { self . opts . compiler . optimizer_runs } else { None } ;
338+ let num_of_optimizations = if self . opts . compiler . optimize . unwrap_or_default ( ) {
339+ self . opts . compiler . optimizer_runs
340+ } else {
341+ None
342+ } ;
340343 let verify = forge_verify:: VerifyArgs {
341344 address,
342345 contract : Some ( self . contract ) ,
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ impl InspectArgs {
5252
5353 // Run Optimized?
5454 let optimized = if field == ContractArtifactField :: AssemblyOptimized {
55- true
55+ Some ( true )
5656 } else {
5757 build. compiler . optimize
5858 } ;
You can’t perform that action at this time.
0 commit comments