mirror of
https://github.com/fafhrd91/actix-web
synced 2025-06-25 06:39:22 +02:00
improve code readability
This commit is contained in:
@ -523,7 +523,7 @@ impl ClientRequest {
|
||||
return Err(InvalidUrl::MissingScheme.into());
|
||||
} else if let Some(scheme) = uri.scheme() {
|
||||
match scheme.as_str() {
|
||||
"http" | "ws" | "https" | "wss" => (),
|
||||
"http" | "ws" | "https" | "wss" => {},
|
||||
_ => return Err(InvalidUrl::UnknownScheme.into()),
|
||||
}
|
||||
} else {
|
||||
|
@ -234,7 +234,7 @@ pub struct JsonBody<S, U> {
|
||||
length: Option<usize>,
|
||||
err: Option<JsonPayloadError>,
|
||||
fut: Option<ReadBody<S>>,
|
||||
_t: PhantomData<U>,
|
||||
_phantom: PhantomData<U>,
|
||||
}
|
||||
|
||||
impl<S, U> JsonBody<S, U>
|
||||
@ -255,7 +255,7 @@ where
|
||||
length: None,
|
||||
fut: None,
|
||||
err: Some(JsonPayloadError::ContentType),
|
||||
_t: PhantomData,
|
||||
_phantom: PhantomData,
|
||||
};
|
||||
}
|
||||
|
||||
@ -272,7 +272,7 @@ where
|
||||
length: len,
|
||||
err: None,
|
||||
fut: Some(ReadBody::new(req.take_payload(), 65536)),
|
||||
_t: PhantomData,
|
||||
_phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
@ -370,14 +370,14 @@ mod tests {
|
||||
async fn test_body() {
|
||||
let mut req = TestResponse::with_header(header::CONTENT_LENGTH, "xxxx").finish();
|
||||
match req.body().await.err().unwrap() {
|
||||
PayloadError::UnknownLength => (),
|
||||
PayloadError::UnknownLength => {},
|
||||
_ => unreachable!("error"),
|
||||
}
|
||||
|
||||
let mut req =
|
||||
TestResponse::with_header(header::CONTENT_LENGTH, "1000000").finish();
|
||||
match req.body().await.err().unwrap() {
|
||||
PayloadError::Overflow => (),
|
||||
PayloadError::Overflow => {},
|
||||
_ => unreachable!("error"),
|
||||
}
|
||||
|
||||
@ -390,7 +390,7 @@ mod tests {
|
||||
.set_payload(Bytes::from_static(b"11111111111111"))
|
||||
.finish();
|
||||
match req.body().limit(5).await.err().unwrap() {
|
||||
PayloadError::Overflow => (),
|
||||
PayloadError::Overflow => {},
|
||||
_ => unreachable!("error"),
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ impl Future for SendClientRequest {
|
||||
SendClientRequest::Fut(send, delay, response_decompress) => {
|
||||
if delay.is_some() {
|
||||
match Pin::new(delay.as_mut().unwrap()).poll(cx) {
|
||||
Poll::Pending => (),
|
||||
Poll::Pending => {},
|
||||
_ => return Poll::Ready(Err(SendRequestError::Timeout)),
|
||||
}
|
||||
}
|
||||
@ -127,7 +127,7 @@ impl Future for SendClientRequest {
|
||||
SendClientRequest::Fut(send, delay, _) => {
|
||||
if delay.is_some() {
|
||||
match Pin::new(delay.as_mut().unwrap()).poll(cx) {
|
||||
Poll::Pending => (),
|
||||
Poll::Pending => {},
|
||||
_ => return Poll::Ready(Err(SendRequestError::Timeout)),
|
||||
}
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ impl WebsocketsRequest {
|
||||
return Err(InvalidUrl::MissingScheme.into());
|
||||
} else if let Some(scheme) = uri.scheme() {
|
||||
match scheme.as_str() {
|
||||
"http" | "ws" | "https" | "wss" => (),
|
||||
"http" | "ws" | "https" | "wss" => {},
|
||||
_ => return Err(InvalidUrl::UnknownScheme.into()),
|
||||
}
|
||||
} else {
|
||||
|
@ -127,7 +127,7 @@ async fn test_timeout() {
|
||||
|
||||
let request = client.get(srv.url("/")).send();
|
||||
match request.await {
|
||||
Err(SendRequestError::Timeout) => (),
|
||||
Err(SendRequestError::Timeout) => {},
|
||||
_ => panic!(),
|
||||
}
|
||||
}
|
||||
@ -149,7 +149,7 @@ async fn test_timeout_override() {
|
||||
.timeout(Duration::from_millis(50))
|
||||
.send();
|
||||
match request.await {
|
||||
Err(SendRequestError::Timeout) => (),
|
||||
Err(SendRequestError::Timeout) => {},
|
||||
_ => panic!(),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user