11use crate :: {
2- all_releases, data_dir, platform, releases:: artifact_url, setup_data_dir, setup_version ,
3- version_binary , SvmError ,
2+ SvmError , all_releases, data_dir, platform, releases:: artifact_url, setup_data_dir,
3+ setup_version , version_binary ,
44} ;
55use semver:: Version ;
66use sha2:: Digest ;
@@ -137,13 +137,12 @@ fn do_install_and_retry(
137137 if err. to_string ( ) . to_lowercase ( ) . contains ( "text file busy" ) {
138138 // busy solc can be in use for a while (e.g. if compiling a large project), so we check if the file exists and has the correct checksum
139139 let solc_path = version_binary ( & version. to_string ( ) ) ;
140- if solc_path. exists ( ) {
141- if let Ok ( content) = fs:: read ( & solc_path) {
142- if ensure_checksum ( & content, version, expected_checksum) . is_ok ( ) {
143- // checksum of the existing file matches the expected release checksum
144- return Ok ( solc_path) ;
145- }
146- }
140+ if solc_path. exists ( )
141+ && let Ok ( content) = fs:: read ( & solc_path)
142+ && ensure_checksum ( & content, version, expected_checksum) . is_ok ( )
143+ {
144+ // checksum of the existing file matches the expected release checksum
145+ return Ok ( solc_path) ;
147146 }
148147
149148 // retry after some time
@@ -366,9 +365,11 @@ mod tests {
366365 install ( & version) . await . unwrap ( ) ;
367366 let solc_path = version_binary ( version. to_string ( ) . as_str ( ) ) ;
368367 let output = Command :: new ( solc_path) . arg ( "--version" ) . output ( ) . unwrap ( ) ;
369- assert ! ( String :: from_utf8_lossy( & output. stdout)
370- . as_ref( )
371- . contains( "0.8.10" ) ) ;
368+ assert ! (
369+ String :: from_utf8_lossy( & output. stdout)
370+ . as_ref( )
371+ . contains( "0.8.10" )
372+ ) ;
372373 }
373374
374375 #[ cfg( feature = "blocking" ) ]
@@ -379,9 +380,11 @@ mod tests {
379380 let solc_path = version_binary ( LATEST . to_string ( ) . as_str ( ) ) ;
380381 let output = Command :: new ( solc_path) . arg ( "--version" ) . output ( ) . unwrap ( ) ;
381382
382- assert ! ( String :: from_utf8_lossy( & output. stdout)
383- . as_ref( )
384- . contains( & LATEST . to_string( ) ) ) ;
383+ assert ! (
384+ String :: from_utf8_lossy( & output. stdout)
385+ . as_ref( )
386+ . contains( & LATEST . to_string( ) )
387+ ) ;
385388 }
386389
387390 #[ cfg( feature = "blocking" ) ]
@@ -393,9 +396,11 @@ mod tests {
393396 let solc_path = version_binary ( version. to_string ( ) . as_str ( ) ) ;
394397 let output = Command :: new ( solc_path) . arg ( "--version" ) . output ( ) . unwrap ( ) ;
395398
396- assert ! ( String :: from_utf8_lossy( & output. stdout)
397- . as_ref( )
398- . contains( "0.8.10" ) ) ;
399+ assert ! (
400+ String :: from_utf8_lossy( & output. stdout)
401+ . as_ref( )
402+ . contains( "0.8.10" )
403+ ) ;
399404 }
400405
401406 #[ cfg( feature = "blocking" ) ]
@@ -460,8 +465,10 @@ mod tests {
460465 let solc_path = version_binary ( version. to_string ( ) . as_str ( ) ) ;
461466 let output = Command :: new ( & solc_path) . arg ( "--version" ) . output ( ) . unwrap ( ) ;
462467
463- assert ! ( String :: from_utf8_lossy( & output. stdout)
464- . as_ref( )
465- . contains( "0.7.1" ) ) ;
468+ assert ! (
469+ String :: from_utf8_lossy( & output. stdout)
470+ . as_ref( )
471+ . contains( "0.7.1" )
472+ ) ;
466473 }
467474}
0 commit comments