@@ -34,9 +34,9 @@ async fn last_commit_from_pr(client: &Client,
3434 json_obj)
3535 ) ;
3636 }
37- None => { return Err ( PreviewerError :: ResponseContentError (
38- "No commits found" . to_owned ( ) ,
39- json_obj) ) }
37+ None => { Err ( PreviewerError :: ResponseContentError (
38+ "No commits found" . to_owned ( ) ,
39+ json_obj) ) }
4040 }
4141}
4242
@@ -47,9 +47,9 @@ async fn last_commit_from_pr(client: &Client,
4747fn extract_run_id_from_detail_url ( url : & str ) -> Result < u64 , PreviewerError > {
4848 let pattern = "/actions/runs/" ;
4949
50- if let Some ( run_id_start_idx) = url. find ( & pattern) {
50+ if let Some ( run_id_start_idx) = url. find ( pattern) {
5151 let url_end = & url[ run_id_start_idx + pattern. len ( ) ..] ;
52- if let Some ( run_id_end_idx) = url_end. find ( "/" ) {
52+ if let Some ( run_id_end_idx) = url_end. find ( '/' ) {
5353 if let Ok ( run_id) = url_end[ ..run_id_end_idx] . parse :: < u64 > ( ) {
5454 return Ok ( run_id) ;
5555 }
@@ -70,7 +70,7 @@ async fn run_id_from_commit(client: &Client,
7070 . and_then ( |jobs| jobs. iter ( ) . find ( |job| job[ "name" ] == "Doc Build and Upload" ) ) {
7171 Some ( job) => {
7272 if let Some ( detail_url) = job[ "details_url" ] . as_str ( ) {
73- extract_run_id_from_detail_url ( & detail_url)
73+ extract_run_id_from_detail_url ( detail_url)
7474 } else {
7575 Err ( PreviewerError :: ResponseContentError (
7676 "details_url not found" . to_owned ( ) ,
@@ -97,21 +97,21 @@ async fn artifact_url_from_run_id(client: &Client,
9797 Some ( artifacts) => {
9898 if artifacts. len ( ) == 1 {
9999 if let Some ( artifact_url) = artifacts[ 0 ] [ "archive_download_url" ] . as_str ( ) {
100- return Ok ( artifact_url. to_owned ( ) ) ;
100+ Ok ( artifact_url. to_owned ( ) )
101101 } else {
102- return Err ( PreviewerError :: ResponseContentError (
103- "artifact url is not a string" . to_owned ( ) ,
104- json_obj) ) ;
102+ Err ( PreviewerError :: ResponseContentError (
103+ "artifact url is not a string" . to_owned ( ) ,
104+ json_obj) )
105105 }
106106 } else {
107- return Err ( PreviewerError :: ResponseContentError (
108- format ! ( "Expected 1 artifact, {} found" , artifacts. len( ) ) ,
109- json_obj) ) ;
107+ Err ( PreviewerError :: ResponseContentError (
108+ format ! ( "Expected 1 artifact, {} found" , artifacts. len( ) ) ,
109+ json_obj) )
110110 }
111111 }
112- None => { return Err ( PreviewerError :: ResponseContentError (
113- "no artifacts found" . to_owned ( ) ,
114- json_obj) ) }
112+ None => { Err ( PreviewerError :: ResponseContentError (
113+ "no artifacts found" . to_owned ( ) ,
114+ json_obj) ) }
115115 }
116116}
117117
@@ -124,7 +124,7 @@ async fn download_artifact(client: &Client,
124124 let mut resp = client. get ( url) . send ( ) . await ?;
125125 let artifact_content = resp. body ( ) . limit ( max_artifact_size) . await ?;
126126 let mut zip_archive = zip:: ZipArchive :: new ( Cursor :: new ( artifact_content) ) ?;
127- zip_archive. extract ( & target_dir) ?;
127+ zip_archive. extract ( target_dir) ?;
128128
129129 // Temporary creating a file inside the directory, so the directory mtime is updated
130130 // This will make sure the directory is not cleaned up when it has recent changes
@@ -144,24 +144,24 @@ pub async fn publish_artifact(client: &Client,
144144
145145 log:: info!( "[PR {}] Preview requested" , pull_request_number) ;
146146
147- let last_commit = last_commit_from_pr ( & client,
148- & base_api_url,
147+ let last_commit = last_commit_from_pr ( client,
148+ base_api_url,
149149 pull_request_number) . await ?;
150150 log:: info!( "[PR {}] Last commit: {}" , pull_request_number, last_commit) ;
151151
152- let run_id = run_id_from_commit ( & client,
153- & base_api_url,
152+ let run_id = run_id_from_commit ( client,
153+ base_api_url,
154154 & last_commit) . await ?;
155155 log:: info!( "[PR {}] Run id: {}" , pull_request_number, run_id) ;
156156
157- let artifact_url = artifact_url_from_run_id ( & client,
158- & base_api_url,
157+ let artifact_url = artifact_url_from_run_id ( client,
158+ base_api_url,
159159 run_id) . await ?;
160160 log:: info!( "[PR {}] Artifact url: {}" , pull_request_number, artifact_url) ;
161161
162162
163163 log:: info!( "[PR {}] Starting artifact download" , pull_request_number) ;
164- download_artifact ( & client, & artifact_url, & target_dir, max_artifact_size) . await ?;
164+ download_artifact ( client, & artifact_url, target_dir, max_artifact_size) . await ?;
165165 log:: info!( "[PR {}] Artifact downloaded to {:?}" , pull_request_number, target_dir) ;
166166
167167 Ok ( ( ) )
0 commit comments