@@ -85,12 +85,12 @@ impl GitSettings {
8585 . arg ( "--short" )
8686 . output ( ) ;
8787
88- if let Ok ( output) = output {
89- if output. status . success ( ) {
90- let branch = String :: from_utf8_lossy ( & output . stdout ) . trim ( ) . to_string ( ) ;
91- if !branch . is_empty ( ) {
92- return branch;
93- }
88+ if let Ok ( output) = output
89+ && output. status . success ( )
90+ {
91+ let branch = String :: from_utf8_lossy ( & output . stdout ) . trim ( ) . to_string ( ) ;
92+ if ! branch. is_empty ( ) {
93+ return branch ;
9494 }
9595 }
9696
@@ -102,17 +102,17 @@ impl GitSettings {
102102 . arg ( "HEAD" )
103103 . output ( ) ;
104104
105- if let Ok ( output) = output {
106- if output. status . success ( ) {
107- let branch_output = String :: from_utf8_lossy ( & output . stdout ) ;
108- if let Some ( branch_line ) = branch_output . lines ( ) . nth ( 1 ) {
109- let branch = branch_line
110- . split_whitespace ( )
111- . next ( )
112- . unwrap_or ( "" )
113- . to_string ( ) ;
114- return branch . trim_start_matches ( "remotes/origin/" ) . to_string ( ) ;
115- }
105+ if let Ok ( output) = output
106+ && output. status . success ( )
107+ {
108+ let branch_output = String :: from_utf8_lossy ( & output . stdout ) ;
109+ if let Some ( branch_line ) = branch_output . lines ( ) . nth ( 1 ) {
110+ let branch = branch_line
111+ . split_whitespace ( )
112+ . next ( )
113+ . unwrap_or ( "" )
114+ . to_string ( ) ;
115+ return branch . trim_start_matches ( "remotes/origin/" ) . to_string ( ) ;
116116 }
117117 }
118118
@@ -201,29 +201,30 @@ impl GithubDownloadRelease {
201201 for arch in [
202202 Some ( & settings. system . arch ) ,
203203 settings. system . arch_variant . as_ref ( ) ,
204- ] {
205- if let Some ( arch) = arch {
206- let file_name = self . get_file_name ( settings, & release, arch) ;
207- file_names. push ( file_name. clone ( ) ) ;
208- if let Some ( download_url) = & self . download_url {
204+ ]
205+ . into_iter ( )
206+ . flatten ( )
207+ {
208+ let file_name = self . get_file_name ( settings, & release, arch) ;
209+ file_names. push ( file_name. clone ( ) ) ;
210+ if let Some ( download_url) = & self . download_url {
211+ return Ok ( Asset {
212+ url : format ! ( "{download_url}/{file_name}" ) ,
213+ name : file_name,
214+ version : release. tag_name . clone ( ) ,
215+ } ) ;
216+ } else {
217+ // Find the asset matching the current architecture
218+ if let Some ( asset) = release
219+ . assets
220+ . iter ( )
221+ . find ( |a| a. name . to_lowercase ( ) == file_name)
222+ {
209223 return Ok ( Asset {
210- url : format ! ( "{download_url}/{file_name}" ) ,
211- name : file_name ,
224+ url : asset . url . clone ( ) ,
225+ name : asset . name . clone ( ) ,
212226 version : release. tag_name . clone ( ) ,
213227 } ) ;
214- } else {
215- // Find the asset matching the current architecture
216- if let Some ( asset) = release
217- . assets
218- . iter ( )
219- . find ( |a| a. name . to_lowercase ( ) == file_name)
220- {
221- return Ok ( Asset {
222- url : asset. url . clone ( ) ,
223- name : asset. name . clone ( ) ,
224- version : release. tag_name . clone ( ) ,
225- } ) ;
226- }
227228 }
228229 }
229230 }
@@ -243,7 +244,12 @@ impl GithubDownloadRelease {
243244 pub fn download ( & self , settings : & Settings ) -> RopsResult < Asset > {
244245 let asset = self . get_asset ( settings) ?;
245246
246- log:: info!( "Download version {} - {} from {}" , asset. version, asset. name, asset. url) ;
247+ log:: info!(
248+ "Download version {} - {} from {}" ,
249+ asset. version,
250+ asset. name,
251+ asset. url
252+ ) ;
247253
248254 // Download the binary using the asset's API URL
249255 let mut response = self
0 commit comments