@@ -104,25 +104,25 @@ impl DefectDojoClient {
104104 } ;
105105
106106 // Get existing entity.
107- info ! ( "Trying to find existing {}" , entity_name ) ;
107+ info ! ( "Trying to find existing {entity_name}" ) ;
108108 let response = self . request ( GET , & url) ?. query ( & query) . send ( ) . await ?;
109109 let results = get_results ( response) . await ?;
110110 if !results. is_empty ( ) {
111111 let id = get_result_id ( & results[ 0 ] ) ?;
112- info ! ( "Found existing {} with id={}" , entity_name , id ) ;
112+ info ! ( "Found existing {entity_name } with id={id}" ) ;
113113 return Ok ( id) ;
114114 }
115115
116116 // Create new entity.
117- info ! ( "Didn't find {} - creating a new one" , entity_name ) ;
117+ info ! ( "Didn't find {entity_name } - creating a new one" ) ;
118118 let response = self . request ( POST , & url) ?. json ( toml) . send ( ) . await ?;
119119 if let Err ( e) = response. error_for_status_ref ( ) {
120120 error ! ( "{}" , response. text( ) . await ?) ;
121- bail ! ( "{}" , e ) ;
121+ bail ! ( "{e}" ) ;
122122 }
123123 let json: serde_json:: Value = response. json ( ) . await ?;
124124 let id = get_result_id ( & json) ?;
125- info ! ( "Created new {} with id={}" , entity_name , id ) ;
125+ info ! ( "Created new {entity_name } with id={id}" ) ;
126126 Ok ( id)
127127 }
128128
@@ -161,16 +161,16 @@ impl DefectDojoClient {
161161 let response = self . request ( GET , & file_url) ?. send ( ) . await ?;
162162 if let Err ( e) = response. error_for_status_ref ( ) {
163163 error ! ( "{}" , response. text( ) . await ?) ;
164- bail ! ( "{}" , e ) ;
164+ bail ! ( "{e}" ) ;
165165 }
166166 let report = response. json :: < CrashReport > ( ) . await ;
167167 if let Err ( e) = report {
168- error ! ( "Failed to parse CASR report {}: {}" , file_url , e ) ;
168+ error ! ( "Failed to parse CASR report {file_url }: {e}" ) ;
169169 return Ok ( None ) ;
170170 }
171171 let hash = compute_report_hash ( & report. unwrap ( ) , & file_url) ;
172172 if let Err ( e) = hash {
173- error ! ( "{}" , e ) ;
173+ error ! ( "{e}" ) ;
174174 return Ok ( None ) ;
175175 }
176176 return Ok ( Some ( hash. unwrap ( ) ) ) ;
@@ -198,7 +198,7 @@ impl DefectDojoClient {
198198 let response = self . request ( POST , & url) ?. multipart ( form) . send ( ) . await ?;
199199 if let Err ( e) = response. error_for_status_ref ( ) {
200200 error ! ( "{}" , response. text( ) . await ?) ;
201- bail ! ( "{}" , e ) ;
201+ bail ! ( "{e}" ) ;
202202 }
203203 Ok ( ( ) )
204204 }
@@ -329,14 +329,11 @@ impl DefectDojoClient {
329329 }
330330 let response: serde_json:: Value = response. json ( ) . await ?;
331331 let id = get_result_id ( & response) ?;
332- debug ! ( "Created new finding '{}' with id={}" , title , id ) ;
332+ debug ! ( "Created new finding '{title }' with id={id}" ) ;
333333
334334 // Upload CASR report.
335335 self . upload_file ( & path, "casrep.json" , "CASR" , id) . await ?;
336- debug ! (
337- "Uploaded CASR report for finding '{}' with id={}" ,
338- title, id
339- ) ;
336+ debug ! ( "Uploaded CASR report for finding '{title}' with id={id}" ) ;
340337
341338 // Upload additional CASR report from GDB.
342339 if gdb. is_some ( ) {
@@ -347,23 +344,21 @@ impl DefectDojoClient {
347344 id,
348345 )
349346 . await ?;
350- debug ! (
351- "Uploaded CASR GDB report for finding '{}' with id={}" ,
352- title, id
353- ) ;
347+ debug ! ( "Uploaded CASR GDB report for finding '{title}' with id={id}" ) ;
354348 }
355349
356350 // Upload crash seed.
357351 let mut crash_path = path. with_extension ( "" ) ;
358- if let Some ( ext) = crash_path. extension ( ) {
359- if ext == "gdb" {
360- crash_path = crash_path . with_extension ( "" ) ;
361- }
352+ if let Some ( ext) = crash_path. extension ( )
353+ && ext == "gdb"
354+ {
355+ crash_path = crash_path . with_extension ( "" ) ;
362356 }
357+
363358 if crash_path. exists ( ) {
364359 self . upload_file ( & crash_path, ".txt" , "Crash seed" , id)
365360 . await ?;
366- debug ! ( "Uploaded crash seed for finding '{}' with id={}" , title , id ) ;
361+ debug ! ( "Uploaded crash seed for finding '{title }' with id={id}" ) ;
367362 }
368363
369364 Ok ( ( ) )
@@ -785,7 +780,7 @@ async fn main() -> Result<()> {
785780 toml:: Value :: String ( test_type_name. to_string ( ) ) ,
786781 ) ;
787782 test_type. insert ( "dynamic_tool" . to_string ( ) , toml:: Value :: Boolean ( true ) ) ;
788- info ! ( "Getting id for test type '{}'" , test_type_name ) ;
783+ info ! ( "Getting id for test type '{test_type_name }'" ) ;
789784 let test_type_id = client. get_or_create_entity ( & test_type, "test_type" ) . await ?;
790785 test. insert ( "test_type" . to_string ( ) , toml:: Value :: Integer ( test_type_id) ) ;
791786 }
@@ -822,10 +817,7 @@ async fn main() -> Result<()> {
822817 ] ) ;
823818
824819 // Wait for findings responses.
825- info ! (
826- "Getting all active, false positive, and out of scope findings for {}" ,
827- product_name
828- ) ;
820+ info ! ( "Getting all active, false positive, and out of scope findings for {product_name}" ) ;
829821 let mut findings = Vec :: new ( ) ;
830822 let mut tasks = tokio:: task:: JoinSet :: new ( ) ;
831823 tasks. spawn ( async move { get_findings_ids ( active) . await } ) ;
@@ -912,7 +904,7 @@ async fn main() -> Result<()> {
912904 break ;
913905 } ;
914906 if let Err ( e) = r? {
915- error ! ( "{}" , e ) ;
907+ error ! ( "{e}" ) ;
916908 }
917909 }
918910
0 commit comments