1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-02-17 10:13:30 +01:00
This commit is contained in:
Rob Ede 2021-01-04 01:01:35 +00:00
parent 21f6c9d7a5
commit 2d4a174420
No known key found for this signature in database
GPG Key ID: C2A3B36E841A91E6
20 changed files with 40 additions and 40 deletions

View File

@ -176,7 +176,7 @@ mod _original {
buf[5] = b'0'; buf[5] = b'0';
buf[7] = b'9'; buf[7] = b'9';
} }
_ => {}, _ => {}
} }
let mut curr: isize = 12; let mut curr: isize = 12;

View File

@ -72,7 +72,7 @@ where
// send request body // send request body
match body.size() { 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?, _ => send_body(body, Pin::new(&mut framed_inner)).await?,
}; };

View File

@ -89,7 +89,7 @@ where
CONNECTION | TRANSFER_ENCODING => continue, // http2 specific CONNECTION | TRANSFER_ENCODING => continue, // http2 specific
CONTENT_LENGTH if skip_len => continue, CONTENT_LENGTH if skip_len => continue,
// DATE => has_date = true, // DATE => has_date = true,
_ => {}, _ => {}
} }
req.headers_mut().append(key, value.clone()); req.headers_mut().append(key, value.clone());
} }

View File

@ -334,7 +334,7 @@ where
let mut read_buf = ReadBuf::new(&mut buf); let mut read_buf = ReadBuf::new(&mut buf);
if let ConnectionType::H1(ref mut s) = io { if let ConnectionType::H1(ref mut s) = io {
match Pin::new(s).poll_read(cx, &mut read_buf) { match Pin::new(s).poll_read(cx, &mut read_buf) {
Poll::Pending => {}, Poll::Pending => {}
Poll::Ready(Ok(())) if !read_buf.filled().is_empty() => { Poll::Ready(Ok(())) if !read_buf.filled().is_empty() => {
if let Some(timeout) = self.config.disconnect_timeout { if let Some(timeout) = self.config.disconnect_timeout {
if let ConnectionType::H1(io) = io { if let ConnectionType::H1(io) = io {

View File

@ -137,7 +137,7 @@ pub(crate) trait MessageType: Sized {
expect = true; expect = true;
} }
} }
_ => {}, _ => {}
} }
headers.append(name, value); headers.append(name, value);
@ -685,7 +685,7 @@ mod tests {
match MessageDecoder::<Request>::default().decode($e) { match MessageDecoder::<Request>::default().decode($e) {
Err(err) => match err { Err(err) => match err {
ParseError::Io(_) => unreachable!("Parse error expected"), ParseError::Io(_) => unreachable!("Parse error expected"),
_ => {}, _ => {}
}, },
_ => unreachable!("Error expected"), _ => unreachable!("Error expected"),
} }

View File

@ -736,7 +736,7 @@ where
let _ = this.ka_timer.as_mut().as_pin_mut().unwrap().poll(cx); let _ = this.ka_timer.as_mut().as_pin_mut().unwrap().poll(cx);
} }
} }
Poll::Pending => {}, Poll::Pending => {}
} }
Ok(()) Ok(())

View File

@ -118,7 +118,7 @@ pub(crate) trait MessageType: Sized {
dst.put_slice(b"connection: close\r\n") dst.put_slice(b"connection: close\r\n")
} }
} }
_ => {}, _ => {}
} }
// merging headers from head and extra headers. HeaderMap::new() does not allocate. // merging headers from head and extra headers. HeaderMap::new() does not allocate.
@ -148,7 +148,7 @@ pub(crate) trait MessageType: Sized {
CONNECTION => continue, CONNECTION => continue,
TRANSFER_ENCODING | CONTENT_LENGTH if skip_len => continue, TRANSFER_ENCODING | CONTENT_LENGTH if skip_len => continue,
DATE => has_date = true, DATE => has_date = true,
_ => {}, _ => {}
} }
let k = key.as_str().as_bytes(); let k = key.as_str().as_bytes();

View File

@ -184,7 +184,7 @@ impl Encoder<Message> for Codec {
} }
} }
}, },
Message::Nop => {}, Message::Nop => {}
} }
Ok(()) Ok(())
} }

View File

@ -125,7 +125,7 @@ impl Parser {
debug!("Received close frame with payload length exceeding 125. Morphing to protocol close frame."); debug!("Received close frame with payload length exceeding 125. Morphing to protocol close frame.");
return Ok(Some((true, OpCode::Close, None))); return Ok(Some((true, OpCode::Close, None)));
} }
_ => {}, _ => {}
} }
// unmask // unmask

View File

@ -222,7 +222,7 @@ mod test {
macro_rules! opcode_into { macro_rules! opcode_into {
($from:expr => $opcode:pat) => { ($from:expr => $opcode:pat) => {
match OpCode::from($from) { match OpCode::from($from) {
e @ $opcode => {}, e @ $opcode => {}
e => unreachable!("{:?}", e), e => unreachable!("{:?}", e),
} }
}; };
@ -232,7 +232,7 @@ mod test {
($from:expr => $opcode:pat) => { ($from:expr => $opcode:pat) => {
let res: u8 = $from.into(); let res: u8 = $from.into();
match res { match res {
e @ $opcode => {}, e @ $opcode => {}
e => unreachable!("{:?}", e), e => unreachable!("{:?}", e),
} }
}; };

View File

@ -326,7 +326,7 @@ impl InnerMultipart {
} }
} }
} }
_ => {}, _ => {}
} }
// read field headers for next field // read field headers for next field
@ -835,7 +835,7 @@ mod tests {
async fn test_boundary() { async fn test_boundary() {
let headers = HeaderMap::new(); let headers = HeaderMap::new();
match Multipart::boundary(&headers) { match Multipart::boundary(&headers) {
Err(MultipartError::NoContentType) => {}, Err(MultipartError::NoContentType) => {}
_ => unreachable!("should not happen"), _ => unreachable!("should not happen"),
} }
@ -846,7 +846,7 @@ mod tests {
); );
match Multipart::boundary(&headers) { match Multipart::boundary(&headers) {
Err(MultipartError::ParseContentType) => {}, Err(MultipartError::ParseContentType) => {}
_ => unreachable!("should not happen"), _ => unreachable!("should not happen"),
} }
@ -856,7 +856,7 @@ mod tests {
header::HeaderValue::from_static("multipart/mixed"), header::HeaderValue::from_static("multipart/mixed"),
); );
match Multipart::boundary(&headers) { match Multipart::boundary(&headers) {
Err(MultipartError::Boundary) => {}, Err(MultipartError::Boundary) => {}
_ => unreachable!("should not happen"), _ => unreachable!("should not happen"),
} }
@ -956,17 +956,17 @@ mod tests {
let mut multipart = Multipart::new(&headers, payload); let mut multipart = Multipart::new(&headers, payload);
match multipart.next().await.unwrap() { match multipart.next().await.unwrap() {
Ok(_) => {}, Ok(_) => {}
_ => unreachable!(), _ => unreachable!(),
} }
match multipart.next().await.unwrap() { match multipart.next().await.unwrap() {
Ok(_) => {}, Ok(_) => {}
_ => unreachable!(), _ => unreachable!(),
} }
match multipart.next().await { match multipart.next().await {
None => {}, None => {}
_ => unreachable!(), _ => unreachable!(),
} }
} }
@ -993,7 +993,7 @@ mod tests {
_ => unreachable!(), _ => unreachable!(),
} }
match field.next().await { match field.next().await {
None => {}, None => {}
_ => unreachable!(), _ => unreachable!(),
} }
} }
@ -1010,7 +1010,7 @@ mod tests {
_ => unreachable!(), _ => unreachable!(),
} }
match field.next().await { match field.next().await {
None => {}, None => {}
_ => unreachable!(), _ => unreachable!(),
} }
} }
@ -1018,7 +1018,7 @@ mod tests {
} }
match multipart.next().await { match multipart.next().await {
None => {}, None => {}
_ => unreachable!(), _ => unreachable!(),
} }
} }
@ -1066,7 +1066,7 @@ mod tests {
} }
match multipart.next().await { match multipart.next().await {
None => {}, None => {}
_ => unreachable!(), _ => unreachable!(),
} }
} }

View File

@ -21,7 +21,7 @@ impl StreamHandler<Result<ws::Message, ws::ProtocolError>> for Ws {
ws::Message::Text(text) => ctx.text(text), ws::Message::Text(text) => ctx.text(text),
ws::Message::Binary(bin) => ctx.binary(bin), ws::Message::Binary(bin) => ctx.binary(bin),
ws::Message::Close(reason) => ctx.close(reason), ws::Message::Close(reason) => ctx.close(reason),
_ => {}, _ => {}
} }
} }
} }

View File

@ -523,7 +523,7 @@ impl ClientRequest {
return Err(InvalidUrl::MissingScheme.into()); return Err(InvalidUrl::MissingScheme.into());
} else if let Some(scheme) = uri.scheme() { } else if let Some(scheme) = uri.scheme() {
match scheme.as_str() { match scheme.as_str() {
"http" | "ws" | "https" | "wss" => {}, "http" | "ws" | "https" | "wss" => {}
_ => return Err(InvalidUrl::UnknownScheme.into()), _ => return Err(InvalidUrl::UnknownScheme.into()),
} }
} else { } else {

View File

@ -370,14 +370,14 @@ mod tests {
async fn test_body() { async fn test_body() {
let mut req = TestResponse::with_header(header::CONTENT_LENGTH, "xxxx").finish(); let mut req = TestResponse::with_header(header::CONTENT_LENGTH, "xxxx").finish();
match req.body().await.err().unwrap() { match req.body().await.err().unwrap() {
PayloadError::UnknownLength => {}, PayloadError::UnknownLength => {}
_ => unreachable!("error"), _ => unreachable!("error"),
} }
let mut req = let mut req =
TestResponse::with_header(header::CONTENT_LENGTH, "1000000").finish(); TestResponse::with_header(header::CONTENT_LENGTH, "1000000").finish();
match req.body().await.err().unwrap() { match req.body().await.err().unwrap() {
PayloadError::Overflow => {}, PayloadError::Overflow => {}
_ => unreachable!("error"), _ => unreachable!("error"),
} }
@ -390,7 +390,7 @@ mod tests {
.set_payload(Bytes::from_static(b"11111111111111")) .set_payload(Bytes::from_static(b"11111111111111"))
.finish(); .finish();
match req.body().limit(5).await.err().unwrap() { match req.body().limit(5).await.err().unwrap() {
PayloadError::Overflow => {}, PayloadError::Overflow => {}
_ => unreachable!("error"), _ => unreachable!("error"),
} }
} }

View File

@ -86,7 +86,7 @@ impl Future for SendClientRequest {
SendClientRequest::Fut(send, delay, response_decompress) => { SendClientRequest::Fut(send, delay, response_decompress) => {
if delay.is_some() { if delay.is_some() {
match Pin::new(delay.as_mut().unwrap()).poll(cx) { match Pin::new(delay.as_mut().unwrap()).poll(cx) {
Poll::Pending => {}, Poll::Pending => {}
_ => return Poll::Ready(Err(SendRequestError::Timeout)), _ => return Poll::Ready(Err(SendRequestError::Timeout)),
} }
} }
@ -127,7 +127,7 @@ impl Future for SendClientRequest {
SendClientRequest::Fut(send, delay, _) => { SendClientRequest::Fut(send, delay, _) => {
if delay.is_some() { if delay.is_some() {
match Pin::new(delay.as_mut().unwrap()).poll(cx) { match Pin::new(delay.as_mut().unwrap()).poll(cx) {
Poll::Pending => {}, Poll::Pending => {}
_ => return Poll::Ready(Err(SendRequestError::Timeout)), _ => return Poll::Ready(Err(SendRequestError::Timeout)),
} }
} }

View File

@ -259,7 +259,7 @@ impl WebsocketsRequest {
return Err(InvalidUrl::MissingScheme.into()); return Err(InvalidUrl::MissingScheme.into());
} else if let Some(scheme) = uri.scheme() { } else if let Some(scheme) = uri.scheme() {
match scheme.as_str() { match scheme.as_str() {
"http" | "ws" | "https" | "wss" => {}, "http" | "ws" | "https" | "wss" => {}
_ => return Err(InvalidUrl::UnknownScheme.into()), _ => return Err(InvalidUrl::UnknownScheme.into()),
} }
} else { } else {

View File

@ -127,7 +127,7 @@ async fn test_timeout() {
let request = client.get(srv.url("/")).send(); let request = client.get(srv.url("/")).send();
match request.await { match request.await {
Err(SendRequestError::Timeout) => {}, Err(SendRequestError::Timeout) => {}
_ => panic!(), _ => panic!(),
} }
} }
@ -149,7 +149,7 @@ async fn test_timeout_override() {
.timeout(Duration::from_millis(50)) .timeout(Duration::from_millis(50))
.send(); .send();
match request.await { match request.await {
Err(SendRequestError::Timeout) => {}, Err(SendRequestError::Timeout) => {}
_ => panic!(), _ => panic!(),
} }
} }

View File

@ -55,7 +55,7 @@ impl ConnectionInfo {
host = Some(val.trim()); host = Some(val.trim());
} }
} }
_ => {}, _ => {}
} }
} }
} }

View File

@ -522,7 +522,7 @@ impl FormatText {
}; };
*self = FormatText::Str(s.to_string()) *self = FormatText::Str(s.to_string())
} }
_ => {}, _ => {}
} }
} }
@ -587,7 +587,7 @@ impl FormatText {
*self = s; *self = s;
} }
_ => {}, _ => {}
} }
} }
} }

View File

@ -539,7 +539,7 @@ mod tests {
.into_parts(); .into_parts();
let res = HttpMessageBody::new(&req, &mut pl).await; let res = HttpMessageBody::new(&req, &mut pl).await;
match res.err().unwrap() { match res.err().unwrap() {
PayloadError::UnknownLength => {}, PayloadError::UnknownLength => {}
_ => unreachable!("error"), _ => unreachable!("error"),
} }
@ -548,7 +548,7 @@ mod tests {
.into_parts(); .into_parts();
let res = HttpMessageBody::new(&req, &mut pl).await; let res = HttpMessageBody::new(&req, &mut pl).await;
match res.err().unwrap() { match res.err().unwrap() {
PayloadError::Overflow => {}, PayloadError::Overflow => {}
_ => unreachable!("error"), _ => unreachable!("error"),
} }
@ -563,7 +563,7 @@ mod tests {
.to_http_parts(); .to_http_parts();
let res = HttpMessageBody::new(&req, &mut pl).limit(5).await; let res = HttpMessageBody::new(&req, &mut pl).limit(5).await;
match res.err().unwrap() { match res.err().unwrap() {
PayloadError::Overflow => {}, PayloadError::Overflow => {}
_ => unreachable!("error"), _ => unreachable!("error"),
} }
} }