File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -256,14 +256,13 @@ async fn get_search_results(
256256// Categorize errors from registry
257257fn handle_registry_error ( err : anyhow:: Error ) -> Result < SearchResult , SearchError > {
258258 // Capture crates.io API error
259- if let Some ( registry_request_error) = err. downcast_ref :: < reqwest:: Error > ( ) {
260- if let Some ( status) = registry_request_error. status ( ) {
261- if status. is_client_error ( ) || status. is_server_error ( ) {
262- return Err ( SearchError :: CratesIo ( format ! (
263- "crates.io returned {status}: {registry_request_error}"
264- ) ) ) ;
265- }
266- }
259+ if let Some ( registry_request_error) = err. downcast_ref :: < reqwest:: Error > ( )
260+ && let Some ( status) = registry_request_error. status ( )
261+ && ( status. is_client_error ( ) || status. is_server_error ( ) )
262+ {
263+ return Err ( SearchError :: CratesIo ( format ! (
264+ "crates.io returned {status}: {registry_request_error}"
265+ ) ) ) ;
267266 }
268267 // Move all other error types to this wrapper
269268 Err ( SearchError :: Other ( err) )
@@ -2237,7 +2236,7 @@ mod tests {
22372236 env. fake_release ( )
22382237 . await
22392238 . name ( "failed" )
2240- . version ( & format ! ( "0.0.{}" , i ) )
2239+ . version ( & format ! ( "0.0.{i}" ) )
22412240 . build_result_failed ( )
22422241 . create ( )
22432242 . await ?;
You can’t perform that action at this time.
0 commit comments