replace match ... { } with matches! macro where possible (#1208)
This commit is contained in:
		
							
								
								
									
										30
									
								
								src/error.rs
									
									
									
									
									
								
							
							
						
						
									
										30
									
								
								src/error.rs
									
									
									
									
									
								
							| @@ -58,26 +58,17 @@ impl Error { | ||||
|  | ||||
|     /// Returns true if the error is from a type Builder. | ||||
|     pub fn is_builder(&self) -> bool { | ||||
|         match self.inner.kind { | ||||
|             Kind::Builder => true, | ||||
|             _ => false, | ||||
|         } | ||||
|         matches!(self.inner.kind, Kind::Builder) | ||||
|     } | ||||
|  | ||||
|     /// Returns true if the error is from a `RedirectPolicy`. | ||||
|     pub fn is_redirect(&self) -> bool { | ||||
|         match self.inner.kind { | ||||
|             Kind::Redirect => true, | ||||
|             _ => false, | ||||
|         } | ||||
|         matches!(self.inner.kind, Kind::Redirect) | ||||
|     } | ||||
|  | ||||
|     /// Returns true if the error is from `Response::error_for_status`. | ||||
|     pub fn is_status(&self) -> bool { | ||||
|         match self.inner.kind { | ||||
|             Kind::Status(_) => true, | ||||
|             _ => false, | ||||
|         } | ||||
|         matches!(self.inner.kind, Kind::Status(_)) | ||||
|     } | ||||
|  | ||||
|     /// Returns true if the error is related to a timeout. | ||||
| @@ -96,10 +87,7 @@ impl Error { | ||||
|  | ||||
|     /// Returns true if the error is related to the request | ||||
|     pub fn is_request(&self) -> bool { | ||||
|         match self.inner.kind { | ||||
|             Kind::Request => true, | ||||
|             _ => false, | ||||
|         } | ||||
|         matches!(self.inner.kind, Kind::Request) | ||||
|     } | ||||
|  | ||||
|     #[cfg(not(target_arch = "wasm32"))] | ||||
| @@ -122,18 +110,12 @@ impl Error { | ||||
|  | ||||
|     /// Returns true if the error is related to the request or response body | ||||
|     pub fn is_body(&self) -> bool { | ||||
|         match self.inner.kind { | ||||
|             Kind::Body => true, | ||||
|             _ => false, | ||||
|         } | ||||
|         matches!(self.inner.kind, Kind::Body) | ||||
|     } | ||||
|  | ||||
|     /// Returns true if the error is related to decoding the response's body | ||||
|     pub fn is_decode(&self) -> bool { | ||||
|         match self.inner.kind { | ||||
|             Kind::Decode => true, | ||||
|             _ => false, | ||||
|         } | ||||
|         matches!(self.inner.kind, Kind::Decode) | ||||
|     } | ||||
|  | ||||
|     /// Returns the status code, if the error was generated from a response. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user