mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-24 00:21:08 +01:00
fmt
This commit is contained in:
parent
21f6c9d7a5
commit
2d4a174420
@ -176,7 +176,7 @@ mod _original {
|
||||
buf[5] = b'0';
|
||||
buf[7] = b'9';
|
||||
}
|
||||
_ => {},
|
||||
_ => {}
|
||||
}
|
||||
|
||||
let mut curr: isize = 12;
|
||||
|
@ -72,7 +72,7 @@ where
|
||||
|
||||
// send request body
|
||||
match body.size() {
|
||||
BodySize::None | BodySize::Empty | BodySize::Sized(0) => {},
|
||||
BodySize::None | BodySize::Empty | BodySize::Sized(0) => {}
|
||||
_ => send_body(body, Pin::new(&mut framed_inner)).await?,
|
||||
};
|
||||
|
||||
|
@ -89,7 +89,7 @@ where
|
||||
CONNECTION | TRANSFER_ENCODING => continue, // http2 specific
|
||||
CONTENT_LENGTH if skip_len => continue,
|
||||
// DATE => has_date = true,
|
||||
_ => {},
|
||||
_ => {}
|
||||
}
|
||||
req.headers_mut().append(key, value.clone());
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ where
|
||||
let mut read_buf = ReadBuf::new(&mut buf);
|
||||
if let ConnectionType::H1(ref mut s) = io {
|
||||
match Pin::new(s).poll_read(cx, &mut read_buf) {
|
||||
Poll::Pending => {},
|
||||
Poll::Pending => {}
|
||||
Poll::Ready(Ok(())) if !read_buf.filled().is_empty() => {
|
||||
if let Some(timeout) = self.config.disconnect_timeout {
|
||||
if let ConnectionType::H1(io) = io {
|
||||
|
@ -137,7 +137,7 @@ pub(crate) trait MessageType: Sized {
|
||||
expect = true;
|
||||
}
|
||||
}
|
||||
_ => {},
|
||||
_ => {}
|
||||
}
|
||||
|
||||
headers.append(name, value);
|
||||
@ -685,7 +685,7 @@ mod tests {
|
||||
match MessageDecoder::<Request>::default().decode($e) {
|
||||
Err(err) => match err {
|
||||
ParseError::Io(_) => unreachable!("Parse error expected"),
|
||||
_ => {},
|
||||
_ => {}
|
||||
},
|
||||
_ => unreachable!("Error expected"),
|
||||
}
|
||||
|
@ -736,7 +736,7 @@ where
|
||||
let _ = this.ka_timer.as_mut().as_pin_mut().unwrap().poll(cx);
|
||||
}
|
||||
}
|
||||
Poll::Pending => {},
|
||||
Poll::Pending => {}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -118,7 +118,7 @@ pub(crate) trait MessageType: Sized {
|
||||
dst.put_slice(b"connection: close\r\n")
|
||||
}
|
||||
}
|
||||
_ => {},
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// merging headers from head and extra headers. HeaderMap::new() does not allocate.
|
||||
@ -148,7 +148,7 @@ pub(crate) trait MessageType: Sized {
|
||||
CONNECTION => continue,
|
||||
TRANSFER_ENCODING | CONTENT_LENGTH if skip_len => continue,
|
||||
DATE => has_date = true,
|
||||
_ => {},
|
||||
_ => {}
|
||||
}
|
||||
|
||||
let k = key.as_str().as_bytes();
|
||||
|
@ -184,7 +184,7 @@ impl Encoder<Message> for Codec {
|
||||
}
|
||||
}
|
||||
},
|
||||
Message::Nop => {},
|
||||
Message::Nop => {}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ impl Parser {
|
||||
debug!("Received close frame with payload length exceeding 125. Morphing to protocol close frame.");
|
||||
return Ok(Some((true, OpCode::Close, None)));
|
||||
}
|
||||
_ => {},
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// unmask
|
||||
|
@ -222,7 +222,7 @@ mod test {
|
||||
macro_rules! opcode_into {
|
||||
($from:expr => $opcode:pat) => {
|
||||
match OpCode::from($from) {
|
||||
e @ $opcode => {},
|
||||
e @ $opcode => {}
|
||||
e => unreachable!("{:?}", e),
|
||||
}
|
||||
};
|
||||
@ -232,7 +232,7 @@ mod test {
|
||||
($from:expr => $opcode:pat) => {
|
||||
let res: u8 = $from.into();
|
||||
match res {
|
||||
e @ $opcode => {},
|
||||
e @ $opcode => {}
|
||||
e => unreachable!("{:?}", e),
|
||||
}
|
||||
};
|
||||
|
@ -326,7 +326,7 @@ impl InnerMultipart {
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => {},
|
||||
_ => {}
|
||||
}
|
||||
|
||||
// read field headers for next field
|
||||
@ -835,7 +835,7 @@ mod tests {
|
||||
async fn test_boundary() {
|
||||
let headers = HeaderMap::new();
|
||||
match Multipart::boundary(&headers) {
|
||||
Err(MultipartError::NoContentType) => {},
|
||||
Err(MultipartError::NoContentType) => {}
|
||||
_ => unreachable!("should not happen"),
|
||||
}
|
||||
|
||||
@ -846,7 +846,7 @@ mod tests {
|
||||
);
|
||||
|
||||
match Multipart::boundary(&headers) {
|
||||
Err(MultipartError::ParseContentType) => {},
|
||||
Err(MultipartError::ParseContentType) => {}
|
||||
_ => unreachable!("should not happen"),
|
||||
}
|
||||
|
||||
@ -856,7 +856,7 @@ mod tests {
|
||||
header::HeaderValue::from_static("multipart/mixed"),
|
||||
);
|
||||
match Multipart::boundary(&headers) {
|
||||
Err(MultipartError::Boundary) => {},
|
||||
Err(MultipartError::Boundary) => {}
|
||||
_ => unreachable!("should not happen"),
|
||||
}
|
||||
|
||||
@ -956,17 +956,17 @@ mod tests {
|
||||
let mut multipart = Multipart::new(&headers, payload);
|
||||
|
||||
match multipart.next().await.unwrap() {
|
||||
Ok(_) => {},
|
||||
Ok(_) => {}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
match multipart.next().await.unwrap() {
|
||||
Ok(_) => {},
|
||||
Ok(_) => {}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
||||
match multipart.next().await {
|
||||
None => {},
|
||||
None => {}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
@ -993,7 +993,7 @@ mod tests {
|
||||
_ => unreachable!(),
|
||||
}
|
||||
match field.next().await {
|
||||
None => {},
|
||||
None => {}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
@ -1010,7 +1010,7 @@ mod tests {
|
||||
_ => unreachable!(),
|
||||
}
|
||||
match field.next().await {
|
||||
None => {},
|
||||
None => {}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
@ -1018,7 +1018,7 @@ mod tests {
|
||||
}
|
||||
|
||||
match multipart.next().await {
|
||||
None => {},
|
||||
None => {}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
@ -1066,7 +1066,7 @@ mod tests {
|
||||
}
|
||||
|
||||
match multipart.next().await {
|
||||
None => {},
|
||||
None => {}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ impl StreamHandler<Result<ws::Message, ws::ProtocolError>> for Ws {
|
||||
ws::Message::Text(text) => ctx.text(text),
|
||||
ws::Message::Binary(bin) => ctx.binary(bin),
|
||||
ws::Message::Close(reason) => ctx.close(reason),
|
||||
_ => {},
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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!(),
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ impl ConnectionInfo {
|
||||
host = Some(val.trim());
|
||||
}
|
||||
}
|
||||
_ => {},
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -522,7 +522,7 @@ impl FormatText {
|
||||
};
|
||||
*self = FormatText::Str(s.to_string())
|
||||
}
|
||||
_ => {},
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -587,7 +587,7 @@ impl FormatText {
|
||||
|
||||
*self = s;
|
||||
}
|
||||
_ => {},
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -539,7 +539,7 @@ mod tests {
|
||||
.into_parts();
|
||||
let res = HttpMessageBody::new(&req, &mut pl).await;
|
||||
match res.err().unwrap() {
|
||||
PayloadError::UnknownLength => {},
|
||||
PayloadError::UnknownLength => {}
|
||||
_ => unreachable!("error"),
|
||||
}
|
||||
|
||||
@ -548,7 +548,7 @@ mod tests {
|
||||
.into_parts();
|
||||
let res = HttpMessageBody::new(&req, &mut pl).await;
|
||||
match res.err().unwrap() {
|
||||
PayloadError::Overflow => {},
|
||||
PayloadError::Overflow => {}
|
||||
_ => unreachable!("error"),
|
||||
}
|
||||
|
||||
@ -563,7 +563,7 @@ mod tests {
|
||||
.to_http_parts();
|
||||
let res = HttpMessageBody::new(&req, &mut pl).limit(5).await;
|
||||
match res.err().unwrap() {
|
||||
PayloadError::Overflow => {},
|
||||
PayloadError::Overflow => {}
|
||||
_ => unreachable!("error"),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user