chore: fix clippy lints (#707)
This commit is contained in:
@@ -186,7 +186,7 @@ mod tests {
|
||||
impl MockBody {
|
||||
pub(super) fn new(b: &[u8], partial_len: usize, count: usize) -> Self {
|
||||
MockBody {
|
||||
data: Bytes::copy_from_slice(&b[..]),
|
||||
data: Bytes::copy_from_slice(b),
|
||||
partial_len,
|
||||
count,
|
||||
}
|
||||
|
||||
@@ -2524,8 +2524,7 @@ mod tests {
|
||||
if key.as_str() == "x-word" {
|
||||
found_x_word = true;
|
||||
} else {
|
||||
// Unexpected key
|
||||
assert!(false);
|
||||
panic!("Unexpected key");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2545,8 +2544,7 @@ mod tests {
|
||||
if key.as_str() == "x-word-bin" {
|
||||
found_x_word_bin = true;
|
||||
} else {
|
||||
// Unexpected key
|
||||
assert!(false);
|
||||
panic!("Unexpected key");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2567,8 +2565,7 @@ mod tests {
|
||||
if key.as_str() == "x-word" {
|
||||
found_x_word = true;
|
||||
} else {
|
||||
// Unexpected key
|
||||
assert!(false);
|
||||
panic!("Unexpected key");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2588,8 +2585,7 @@ mod tests {
|
||||
if key.as_str() == "x-word-bin" {
|
||||
found_x_word_bin = true;
|
||||
} else {
|
||||
// Unexpected key
|
||||
assert!(false);
|
||||
panic!("Unexpected key");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2610,8 +2606,7 @@ mod tests {
|
||||
if key.as_str() == "x-word" {
|
||||
found_x_word = true;
|
||||
} else {
|
||||
// Unexpected key
|
||||
assert!(false);
|
||||
panic!("Unexpected key");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2631,8 +2626,7 @@ mod tests {
|
||||
if key.as_str() == "x-number-bin" {
|
||||
found_x_number_bin = true;
|
||||
} else {
|
||||
// Unexpected key
|
||||
assert!(false);
|
||||
panic!("Unexpected key");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2653,8 +2647,7 @@ mod tests {
|
||||
if *value == "hello" {
|
||||
found_x_word = true;
|
||||
} else {
|
||||
// Unexpected key
|
||||
assert!(false);
|
||||
panic!("Unexpected key");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![allow(clippy::upper_case_acronyms)]
|
||||
|
||||
use super::encoding::{
|
||||
Ascii, Binary, InvalidMetadataValue, InvalidMetadataValueBytes, ValueEncoding,
|
||||
};
|
||||
|
||||
+4
-4
@@ -738,7 +738,7 @@ impl Code {
|
||||
}
|
||||
}
|
||||
|
||||
fn to_header_value(&self) -> HeaderValue {
|
||||
fn to_header_value(self) -> HeaderValue {
|
||||
match self {
|
||||
Code::Ok => HeaderValue::from_static("0"),
|
||||
Code::Cancelled => HeaderValue::from_static("1"),
|
||||
@@ -921,16 +921,16 @@ mod tests {
|
||||
|
||||
let status = Status::with_details(Code::Unavailable, "some message", DETAILS.into());
|
||||
|
||||
assert_eq!(&status.details()[..], DETAILS);
|
||||
assert_eq!(status.details(), DETAILS);
|
||||
|
||||
let header_map = status.to_header_map().unwrap();
|
||||
|
||||
let b64_details = base64::encode_config(&DETAILS[..], base64::STANDARD_NO_PAD);
|
||||
let b64_details = base64::encode_config(DETAILS, base64::STANDARD_NO_PAD);
|
||||
|
||||
assert_eq!(header_map[super::GRPC_STATUS_DETAILS_HEADER], b64_details);
|
||||
|
||||
let status = Status::from_header_map(&header_map).unwrap();
|
||||
|
||||
assert_eq!(&status.details()[..], DETAILS);
|
||||
assert_eq!(status.details(), DETAILS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ impl Channel {
|
||||
C::Future: Unpin + Send,
|
||||
C::Response: AsyncRead + AsyncWrite + HyperConnection + Unpin + Send + 'static,
|
||||
{
|
||||
let buffer_size = endpoint.buffer_size.clone().unwrap_or(DEFAULT_BUFFER_SIZE);
|
||||
let buffer_size = endpoint.buffer_size.unwrap_or(DEFAULT_BUFFER_SIZE);
|
||||
|
||||
let svc = Connection::lazy(connector, endpoint);
|
||||
let svc = Buffer::new(Either::A(svc), buffer_size);
|
||||
@@ -152,7 +152,7 @@ impl Channel {
|
||||
C::Future: Unpin + Send,
|
||||
C::Response: AsyncRead + AsyncWrite + HyperConnection + Unpin + Send + 'static,
|
||||
{
|
||||
let buffer_size = endpoint.buffer_size.clone().unwrap_or(DEFAULT_BUFFER_SIZE);
|
||||
let buffer_size = endpoint.buffer_size.unwrap_or(DEFAULT_BUFFER_SIZE);
|
||||
|
||||
let svc = Connection::connect(connector, endpoint)
|
||||
.await
|
||||
|
||||
@@ -142,7 +142,7 @@ where
|
||||
tracing::trace!("Reconnect::call");
|
||||
if let Some(error) = self.error.take() {
|
||||
tracing::debug!("error: {}", error);
|
||||
return ResponseFuture::error(error.into());
|
||||
return ResponseFuture::error(error);
|
||||
}
|
||||
|
||||
let service = match self.state {
|
||||
|
||||
@@ -49,7 +49,7 @@ impl TlsConnector {
|
||||
domain: String,
|
||||
) -> Result<Self, crate::Error> {
|
||||
let mut config = ClientConfig::new();
|
||||
config.set_protocols(&[Vec::from(&ALPN_H2[..])]);
|
||||
config.set_protocols(&[Vec::from(ALPN_H2)]);
|
||||
|
||||
if let Some(identity) = identity {
|
||||
let (client_cert, client_key) = rustls_keys::load_identity(identity)?;
|
||||
@@ -60,7 +60,7 @@ impl TlsConnector {
|
||||
{
|
||||
config.root_store = match rustls_native_certs::load_native_certs() {
|
||||
Ok(store) | Err((Some(store), _)) => store,
|
||||
Err((None, error)) => Err(error)?,
|
||||
Err((None, error)) => return Err(error.into()),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ impl TlsAcceptor {
|
||||
}
|
||||
};
|
||||
config.set_single_cert(cert, key)?;
|
||||
config.set_protocols(&[Vec::from(&ALPN_H2[..])]);
|
||||
config.set_protocols(&[Vec::from(ALPN_H2)]);
|
||||
|
||||
Ok(Self {
|
||||
inner: Arc::new(config),
|
||||
|
||||
Reference in New Issue
Block a user