chore: Fix clippy lint (#1181)

This commit is contained in:
tottoto
2022-12-14 01:29:29 +09:00
committed by GitHub
parent 3076e8251e
commit 2dd09c02bd
23 changed files with 98 additions and 62 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ impl Greeter for MyGreeter {
println!("Got a request: {:?}", request);
let reply = hello_world::HelloReply {
message: format!("Hello {}!", request.into_inner().name).into(),
message: format!("Hello {}!", request.into_inner().name),
};
Ok(Response::new(reply))
+3 -3
View File
@@ -113,7 +113,7 @@ impl fmt::Display for TestAssertion {
macro_rules! test_assert {
($description:expr, $assertion:expr) => {
if $assertion {
crate::TestAssertion::Passed {
$crate::TestAssertion::Passed {
description: $description,
}
} else {
@@ -126,11 +126,11 @@ macro_rules! test_assert {
};
($description:expr, $assertion:expr, $why:expr) => {
if $assertion {
crate::TestAssertion::Passed {
$crate::TestAssertion::Passed {
description: $description,
}
} else {
crate::TestAssertion::Failed {
$crate::TestAssertion::Failed {
description: $description,
expression: stringify!($assertion),
why: Some($why),
+1 -1
View File
@@ -13,5 +13,5 @@ prost = "0.11"
tonic = { path = "../../tonic" }
[build-dependencies]
prost-build = "0.11"
prost-build = "0.11.4"
tonic-build = { path = "../../tonic-build" }
+1 -1
View File
@@ -1,6 +1,6 @@
fn main() {
let mut config = prost_build::Config::default();
config.disable_comments(&["test.Input1", "test.Output1"]);
config.disable_comments(["test.Input1", "test.Output1"]);
tonic_build::configure()
.disable_comments("test.Service1")
.disable_comments("test.Service1.Rpc1")
+1 -1
View File
@@ -12,4 +12,4 @@ version = "0.1.0"
bytes = "1.0"
prost = "0.11"
[build-dependencies]
prost-build = "0.11"
prost-build = "0.11.4"
+1 -1
View File
@@ -17,7 +17,7 @@ async fn status_from_server_stream_with_source() {
&self,
_: Request<InputStream>,
) -> Result<Response<Self::StreamCallStream>, Status> {
let s = Unsync(0 as *mut ());
let s = Unsync(std::ptr::null_mut::<()>());
Ok(Response::new(Box::pin(s) as Self::StreamCallStream))
}
+1
View File
@@ -1,3 +1,4 @@
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Animal {
#[prost(string, optional, tag = "1")]
+1 -1
View File
@@ -16,5 +16,5 @@ prost = "0.11"
tonic = {path = "../../tonic"}
[build-dependencies]
prost-build = "0.11"
prost-build = "0.11.4"
tonic-build = {path = "../../tonic-build"}
+1 -1
View File
@@ -17,7 +17,7 @@ version = "0.8.4"
[dependencies]
prettyplease = { version = "0.1" }
proc-macro2 = "1.0"
prost-build = { version = "0.11.2", optional = true }
prost-build = { version = "0.11.4", optional = true }
quote = "1.0"
syn = "1.0"
@@ -1,8 +1,10 @@
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HealthCheckRequest {
#[prost(string, tag = "1")]
pub service: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct HealthCheckResponse {
#[prost(enumeration = "health_check_response::ServingStatus", tag = "1")]
+1 -1
View File
@@ -36,7 +36,7 @@ pub mod proto {
pub mod server;
/// An enumeration of values representing gRPC service health.
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum ServingStatus {
/// Unknown status
Unknown,
+1 -1
View File
@@ -27,6 +27,6 @@ tonic = { version = "0.8", path = "../tonic", default-features = false, features
[dev-dependencies]
tonic = { version = "0.8", path = "../tonic", default-features = false, features = ["transport"] }
tonic-build = { version = "0.8", path = "../tonic-build", default-features = false, features = ["prost"] }
tonic-build = { version = "0.8", path = "../tonic-build", default-features = false, features = ["prost", "cleanup-markdown"] }
futures = "0.3"
futures-util = "0.3"
@@ -1,4 +1,5 @@
/// The message sent by the client when calling ServerReflectionInfo method.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ServerReflectionRequest {
#[prost(string, tag = "1")]
@@ -16,6 +17,7 @@ pub mod server_reflection_request {
/// To use reflection service, the client should set one of the following
/// fields in message_request. The server distinguishes requests by their
/// defined field and then handles them using corresponding methods.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum MessageRequest {
/// Find a proto file by the file name.
@@ -48,6 +50,7 @@ pub mod server_reflection_request {
}
/// The type name and extension number sent by the client when requesting
/// file_containing_extension.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExtensionRequest {
/// Fully-qualified type name. The format should be <package>.<type>
@@ -57,6 +60,7 @@ pub struct ExtensionRequest {
pub extension_number: i32,
}
/// The message sent by the server to answer ServerReflectionInfo method.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ServerReflectionResponse {
#[prost(string, tag = "1")]
@@ -74,6 +78,7 @@ pub struct ServerReflectionResponse {
pub mod server_reflection_response {
/// The server sets one of the following fields according to the
/// message_request in the request.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum MessageResponse {
/// This message is used to answer file_by_filename, file_containing_symbol,
@@ -98,6 +103,7 @@ pub mod server_reflection_response {
/// Serialized FileDescriptorProto messages sent by the server answering
/// a file_by_filename, file_containing_symbol, or file_containing_extension
/// request.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FileDescriptorResponse {
/// Serialized FileDescriptorProto messages. We avoid taking a dependency on
@@ -108,6 +114,7 @@ pub struct FileDescriptorResponse {
}
/// A list of extension numbers sent by the server answering
/// all_extension_numbers_of_type request.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ExtensionNumberResponse {
/// Full name of the base type, including the package name. The format
@@ -118,6 +125,7 @@ pub struct ExtensionNumberResponse {
pub extension_number: ::prost::alloc::vec::Vec<i32>,
}
/// A list of ServiceResponse sent by the server answering list_services request.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListServiceResponse {
/// The information of each service may be expanded in the future, so we use
@@ -127,6 +135,7 @@ pub struct ListServiceResponse {
}
/// The information of a single service used by ListServiceResponse to answer
/// list_services request.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ServiceResponse {
/// Full name of a registered service, including its package name. The format
@@ -135,6 +144,7 @@ pub struct ServiceResponse {
pub name: ::prost::alloc::string::String,
}
/// The error code and error message sent by the server when an error occurs.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ErrorResponse {
/// This field uses the error codes defined in grpc::StatusCode.
+15
View File
@@ -5,6 +5,7 @@
///
/// You can find out more about this error model and how to work with it in the
/// [API Design Guide](<https://cloud.google.com/apis/design/errors>).
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Status {
/// The status code, which should be an enum value of \\[google.rpc.Code\]\[google.rpc.Code\\].
@@ -33,6 +34,7 @@ pub struct Status {
/// the delay between retries based on `retry_delay`, until either a maximum
/// number of retries have been reached or a maximum retry delay cap has been
/// reached.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RetryInfo {
/// Clients should wait at least this long between retrying the same request.
@@ -40,6 +42,7 @@ pub struct RetryInfo {
pub retry_delay: ::core::option::Option<::prost_types::Duration>,
}
/// Describes additional debugging info.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DebugInfo {
/// The stack trace entries indicating where the error occurred.
@@ -60,6 +63,7 @@ pub struct DebugInfo {
///
/// Also see RetryInfo and Help types for other details about handling a
/// quota failure.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QuotaFailure {
/// Describes all quota violations.
@@ -70,6 +74,7 @@ pub struct QuotaFailure {
pub mod quota_failure {
/// A message type used to describe a single quota violation. For example, a
/// daily quota or a custom quota that was exceeded.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Violation {
/// The subject on which the quota check failed.
@@ -116,6 +121,7 @@ pub mod quota_failure {
/// }
/// }
/// ```
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ErrorInfo {
/// The reason of the error. This is a constant value that identifies the
@@ -151,6 +157,7 @@ pub struct ErrorInfo {
/// For example, if an RPC failed because it required the Terms of Service to be
/// acknowledged, it could list the terms of service violation in the
/// PreconditionFailure message.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PreconditionFailure {
/// Describes all precondition violations.
@@ -160,6 +167,7 @@ pub struct PreconditionFailure {
/// Nested message and enum types in `PreconditionFailure`.
pub mod precondition_failure {
/// A message type used to describe a single precondition failure.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Violation {
/// The type of PreconditionFailure. We recommend using a service-specific
@@ -182,6 +190,7 @@ pub mod precondition_failure {
}
/// Describes violations in a client request. This error type focuses on the
/// syntactic aspects of the request.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BadRequest {
/// Describes all violations in a client request.
@@ -191,6 +200,7 @@ pub struct BadRequest {
/// Nested message and enum types in `BadRequest`.
pub mod bad_request {
/// A message type used to describe a single bad request field.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FieldViolation {
/// A path leading to a field in the request body. The value will be a
@@ -205,6 +215,7 @@ pub mod bad_request {
}
/// Contains metadata about the request that clients can attach when filing a bug
/// or providing other forms of feedback.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestInfo {
/// An opaque string that should only be interpreted by the service generating
@@ -217,6 +228,7 @@ pub struct RequestInfo {
pub serving_data: ::prost::alloc::string::String,
}
/// Describes the resource that is being accessed.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResourceInfo {
/// A name for the type of resource being accessed, e.g. "sql table",
@@ -245,6 +257,7 @@ pub struct ResourceInfo {
/// For example, if a quota check failed with an error indicating the calling
/// project hasn't enabled the accessed service, this can contain a URL pointing
/// directly to the right place in the developer console to flip the bit.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Help {
/// URL(s) pointing to additional information on handling the current error.
@@ -254,6 +267,7 @@ pub struct Help {
/// Nested message and enum types in `Help`.
pub mod help {
/// Describes a URL link.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Link {
/// Describes what the link offers.
@@ -266,6 +280,7 @@ pub mod help {
}
/// Provides a localized error message that is safe to return to the user
/// which can be attached to an RPC error.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LocalizedMessage {
/// The locale used following the specification defined at
@@ -247,3 +247,9 @@ impl ErrorDetails {
false
}
}
impl Default for ErrorDetails {
fn default() -> Self {
Self::new()
}
}
+12 -16
View File
@@ -20,10 +20,10 @@ trait FromAny {
Self: Sized;
}
fn gen_details_bytes(code: Code, message: &String, details: Vec<Any>) -> Bytes {
fn gen_details_bytes(code: Code, message: &str, details: Vec<Any>) -> Bytes {
let status = pb::Status {
code: code as i32,
message: message.clone(),
message: message.to_owned(),
details,
};
@@ -411,7 +411,7 @@ impl StatusExt for tonic::Status {
}
fn get_error_details(&self) -> ErrorDetails {
self.check_error_details().unwrap_or(ErrorDetails::new())
self.check_error_details().unwrap_or_default()
}
fn check_error_details_vec(&self) -> Result<Vec<ErrorDetail>, DecodeError> {
@@ -438,19 +438,17 @@ impl StatusExt for tonic::Status {
}
fn get_error_details_vec(&self) -> Vec<ErrorDetail> {
self.check_error_details_vec().unwrap_or(Vec::new())
self.check_error_details_vec().unwrap_or_default()
}
fn get_details_retry_info(&self) -> Option<RetryInfo> {
let status = pb::Status::decode(self.details()).ok()?;
for any in status.details.into_iter() {
match any.type_url.as_str() {
RetryInfo::TYPE_URL => match RetryInfo::from_any(any) {
Ok(detail) => return Some(detail),
Err(_) => {}
},
_ => {}
if any.type_url.as_str() == RetryInfo::TYPE_URL {
if let Ok(detail) = RetryInfo::from_any(any) {
return Some(detail);
}
}
}
@@ -477,12 +475,10 @@ impl StatusExt for tonic::Status {
let status = pb::Status::decode(self.details()).ok()?;
for any in status.details.into_iter() {
match any.type_url.as_str() {
BadRequest::TYPE_URL => match BadRequest::from_any(any) {
Ok(detail) => return Some(detail),
Err(_) => {}
},
_ => {}
if any.type_url.as_str() == BadRequest::TYPE_URL {
if let Ok(detail) = BadRequest::from_any(any) {
return Some(detail);
}
}
}
@@ -153,7 +153,7 @@ mod tests {
);
assert!(
br_details.is_empty() == false,
!br_details.is_empty(),
"filled BadRequest returns 'true' from .is_empty()"
);
@@ -7,7 +7,7 @@ use super::super::{pb, FromAny, IntoAny};
/// Used to encode/decode the `RetryInfo` standard error message described in
/// [error_details.proto]. Describes when the clients can retry a failed
/// request.
/// request.
/// Note: When obtained from decoding `RetryInfo` messages, negative
/// `retry_delay`'s become 0.
///
@@ -119,7 +119,7 @@ mod tests {
);
assert!(
error_info.is_empty() == false,
!error_info.is_empty(),
"filled RetryInfo returns 'false' from .has_retry_delay()"
);
+6
View File
@@ -16,6 +16,12 @@ impl GrpcWebLayer {
}
}
impl Default for GrpcWebLayer {
fn default() -> Self {
Self::new()
}
}
impl<S> Layer<S> for GrpcWebLayer
where
S: Service<http::Request<hyper::Body>, Response = http::Response<BoxBody>>,
+1 -1
View File
@@ -247,7 +247,7 @@ impl<VE: ValueEncoding> PartialEq<MetadataKey<VE>> for str {
/// ```
#[inline]
fn eq(&self, other: &MetadataKey<VE>) -> bool {
(*other).inner == *self
other.inner == *self
}
}
+27 -27
View File
@@ -1362,7 +1362,7 @@ where
match self.inner {
Some(ref mut inner) => inner
.next()
.map(&MetadataValue::unchecked_from_header_value_ref),
.map(MetadataValue::unchecked_from_header_value_ref),
None => None,
}
}
@@ -1383,7 +1383,7 @@ where
match self.inner {
Some(ref mut inner) => inner
.next_back()
.map(&MetadataValue::unchecked_from_header_value_ref),
.map(MetadataValue::unchecked_from_header_value_ref),
None => None,
}
}
@@ -1400,7 +1400,7 @@ where
fn next(&mut self) -> Option<Self::Item> {
self.inner
.next()
.map(&MetadataValue::unchecked_from_mut_header_value_ref)
.map(MetadataValue::unchecked_from_mut_header_value_ref)
}
}
@@ -1411,7 +1411,7 @@ where
fn next_back(&mut self) -> Option<Self::Item> {
self.inner
.next_back()
.map(&MetadataValue::unchecked_from_mut_header_value_ref)
.map(MetadataValue::unchecked_from_mut_header_value_ref)
}
}
@@ -1992,7 +1992,7 @@ impl<'a, 'b: 'a, VE: ValueEncoding> IntoIterator for &'b GetAll<'a, VE> {
fn into_iter(self) -> ValueIter<'a, VE> {
ValueIter {
inner: (&self.inner).as_ref().map(|inner| inner.into_iter()),
inner: self.inner.as_ref().map(|inner| inner.into_iter()),
phantom: PhantomData,
}
}
@@ -2037,7 +2037,7 @@ mod into_metadata_key {
) -> Option<MetadataValue<VE>> {
map.headers
.insert(self.inner, val.inner)
.map(&MetadataValue::unchecked_from_header_value)
.map(MetadataValue::unchecked_from_header_value)
}
#[doc(hidden)]
@@ -2059,7 +2059,7 @@ mod into_metadata_key {
) -> Option<MetadataValue<VE>> {
map.headers
.insert(&self.inner, val.inner)
.map(&MetadataValue::unchecked_from_header_value)
.map(MetadataValue::unchecked_from_header_value)
}
#[doc(hidden)]
#[inline]
@@ -2083,7 +2083,7 @@ mod into_metadata_key {
map.headers
.insert(key.inner, val.inner)
.map(&MetadataValue::unchecked_from_header_value)
.map(MetadataValue::unchecked_from_header_value)
}
#[doc(hidden)]
#[inline]
@@ -2141,7 +2141,7 @@ mod as_metadata_key {
fn get(self, map: &MetadataMap) -> Option<&MetadataValue<VE>> {
map.headers
.get(self.inner)
.map(&MetadataValue::unchecked_from_header_value_ref)
.map(MetadataValue::unchecked_from_header_value_ref)
}
#[doc(hidden)]
@@ -2149,7 +2149,7 @@ mod as_metadata_key {
fn get_mut(self, map: &mut MetadataMap) -> Option<&mut MetadataValue<VE>> {
map.headers
.get_mut(self.inner)
.map(&MetadataValue::unchecked_from_mut_header_value_ref)
.map(MetadataValue::unchecked_from_mut_header_value_ref)
}
#[doc(hidden)]
@@ -2172,7 +2172,7 @@ mod as_metadata_key {
fn remove(self, map: &mut MetadataMap) -> Option<MetadataValue<VE>> {
map.headers
.remove(self.inner)
.map(&MetadataValue::unchecked_from_header_value)
.map(MetadataValue::unchecked_from_header_value)
}
}
@@ -2184,7 +2184,7 @@ mod as_metadata_key {
fn get(self, map: &MetadataMap) -> Option<&MetadataValue<VE>> {
map.headers
.get(&self.inner)
.map(&MetadataValue::unchecked_from_header_value_ref)
.map(MetadataValue::unchecked_from_header_value_ref)
}
#[doc(hidden)]
@@ -2192,7 +2192,7 @@ mod as_metadata_key {
fn get_mut(self, map: &mut MetadataMap) -> Option<&mut MetadataValue<VE>> {
map.headers
.get_mut(&self.inner)
.map(&MetadataValue::unchecked_from_mut_header_value_ref)
.map(MetadataValue::unchecked_from_mut_header_value_ref)
}
#[doc(hidden)]
@@ -2215,7 +2215,7 @@ mod as_metadata_key {
fn remove(self, map: &mut MetadataMap) -> Option<MetadataValue<VE>> {
map.headers
.remove(&self.inner)
.map(&MetadataValue::unchecked_from_header_value)
.map(MetadataValue::unchecked_from_header_value)
}
}
@@ -2230,7 +2230,7 @@ mod as_metadata_key {
}
map.headers
.get(self)
.map(&MetadataValue::unchecked_from_header_value_ref)
.map(MetadataValue::unchecked_from_header_value_ref)
}
#[doc(hidden)]
@@ -2241,7 +2241,7 @@ mod as_metadata_key {
}
map.headers
.get_mut(self)
.map(&MetadataValue::unchecked_from_mut_header_value_ref)
.map(MetadataValue::unchecked_from_mut_header_value_ref)
}
#[doc(hidden)]
@@ -2277,7 +2277,7 @@ mod as_metadata_key {
}
map.headers
.remove(self)
.map(&MetadataValue::unchecked_from_header_value)
.map(MetadataValue::unchecked_from_header_value)
}
}
@@ -2292,7 +2292,7 @@ mod as_metadata_key {
}
map.headers
.get(self.as_str())
.map(&MetadataValue::unchecked_from_header_value_ref)
.map(MetadataValue::unchecked_from_header_value_ref)
}
#[doc(hidden)]
@@ -2303,7 +2303,7 @@ mod as_metadata_key {
}
map.headers
.get_mut(self.as_str())
.map(&MetadataValue::unchecked_from_mut_header_value_ref)
.map(MetadataValue::unchecked_from_mut_header_value_ref)
}
#[doc(hidden)]
@@ -2338,7 +2338,7 @@ mod as_metadata_key {
}
map.headers
.remove(self.as_str())
.map(&MetadataValue::unchecked_from_header_value)
.map(MetadataValue::unchecked_from_header_value)
}
}
@@ -2353,7 +2353,7 @@ mod as_metadata_key {
}
map.headers
.get(self.as_str())
.map(&MetadataValue::unchecked_from_header_value_ref)
.map(MetadataValue::unchecked_from_header_value_ref)
}
#[doc(hidden)]
@@ -2364,7 +2364,7 @@ mod as_metadata_key {
}
map.headers
.get_mut(self.as_str())
.map(&MetadataValue::unchecked_from_mut_header_value_ref)
.map(MetadataValue::unchecked_from_mut_header_value_ref)
}
#[doc(hidden)]
@@ -2399,7 +2399,7 @@ mod as_metadata_key {
}
map.headers
.remove(self.as_str())
.map(&MetadataValue::unchecked_from_header_value)
.map(MetadataValue::unchecked_from_header_value)
}
}
@@ -2520,7 +2520,7 @@ mod tests {
let mut found_x_word = false;
for key_and_value in map.iter() {
if let KeyAndValueRef::Ascii(ref key, ref _value) = key_and_value {
if let KeyAndValueRef::Ascii(key, _value) = key_and_value {
if key.as_str() == "x-word" {
found_x_word = true;
} else {
@@ -2540,7 +2540,7 @@ mod tests {
let mut found_x_word_bin = false;
for key_and_value in map.iter() {
if let KeyAndValueRef::Binary(ref key, ref _value) = key_and_value {
if let KeyAndValueRef::Binary(key, _value) = key_and_value {
if key.as_str() == "x-word-bin" {
found_x_word_bin = true;
} else {
@@ -2561,7 +2561,7 @@ mod tests {
let mut found_x_word = false;
for key_and_value in map.iter_mut() {
if let KeyAndMutValueRef::Ascii(ref key, ref _value) = key_and_value {
if let KeyAndMutValueRef::Ascii(key, _value) = key_and_value {
if key.as_str() == "x-word" {
found_x_word = true;
} else {
@@ -2581,7 +2581,7 @@ mod tests {
let mut found_x_word_bin = false;
for key_and_value in map.iter_mut() {
if let KeyAndMutValueRef::Binary(ref key, ref _value) = key_and_value {
if let KeyAndMutValueRef::Binary(key, _value) = key_and_value {
if key.as_str() == "x-word-bin" {
found_x_word_bin = true;
} else {
+1 -1
View File
@@ -349,7 +349,7 @@ mod tests {
Ok::<_, hyper::Error>(hyper::Response::new(hyper::Body::empty()))
});
let svc = InterceptedService::new(svc, |request: crate::Request<()>| Ok(request));
let svc = InterceptedService::new(svc, Ok);
let request = http::Request::builder()
.method(http::Method::OPTIONS)
+2 -2
View File
@@ -70,7 +70,7 @@ impl AsyncWrite for BoxedIo {
pub(crate) enum ServerIo<IO> {
Io(IO),
#[cfg(feature = "tls")]
TlsIo(TlsStream<IO>),
TlsIo(Box<TlsStream<IO>>),
}
use tower::util::Either;
@@ -89,7 +89,7 @@ impl<IO> ServerIo<IO> {
#[cfg(feature = "tls")]
pub(in crate::transport) fn new_tls_io(io: TlsStream<IO>) -> Self {
Self::TlsIo(io)
Self::TlsIo(Box::new(io))
}
#[cfg(feature = "tls")]