Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rust-server] Fix clippy warnings #13907

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@
{{/-first}}
{{^isMap}}
{{^required}}
#[allow(clippy::single_match)]
match param_{{{paramName}}} {
Some(param_{{{paramName}}}) => {
{{/required}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
#![allow(unused_imports, unused_attributes)]
#![allow(clippy::derive_partial_eq_without_eq, clippy::blacklisted_name)]
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]

use async_trait::async_trait;
use futures::Stream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl<'a> std::iter::IntoIterator for &'a {{{classname}}} {
type IntoIter = std::slice::Iter<'a, {{{arrayModelType}}}>;

fn into_iter(self) -> Self::IntoIter {
(&self.0).iter()
self.0.iter()
}
}

Expand All @@ -198,7 +198,7 @@ impl<'a> std::iter::IntoIterator for &'a mut {{{classname}}} {
type IntoIter = std::slice::IterMut<'a, {{{arrayModelType}}}>;

fn into_iter(self) -> Self::IntoIter {
(&mut self.0).iter_mut()
self.0.iter_mut()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
// Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
{{/-first}}
let param_{{{paramName}}} = query_params.iter().filter(|e| e.0 == "{{{baseName}}}").map(|e| e.1.to_owned())
let param_{{{paramName}}} = query_params.iter().filter(|e| e.0 == "{{{baseName}}}").map(|e| e.1.clone())
{{#isArray}}
{{^vendorExtensions.x-consumes-json}}
.filter_map(|param_{{{paramName}}}| param_{{{paramName}}}.parse().ok())
Expand Down Expand Up @@ -221,7 +221,7 @@
let deserializer = &mut serde_xml_rs::de::Deserializer::new_from_reader(&*body);
{{/x-consumes-xml}}
{{#x-consumes-json}}
let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
let deserializer = &mut serde_json::Deserializer::from_slice(&body);
{{/x-consumes-json}}
{{^x-consumes-plain-text}}
match serde_ignored::deserialize(deserializer, |path| {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
#![allow(unused_imports, unused_attributes)]
#![allow(clippy::derive_partial_eq_without_eq, clippy::blacklisted_name)]
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]

use async_trait::async_trait;
use futures::Stream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
#![allow(unused_imports, unused_attributes)]
#![allow(clippy::derive_partial_eq_without_eq, clippy::blacklisted_name)]
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]

use async_trait::async_trait;
use futures::Stream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
Ok(body) => {
let mut unused_elements = Vec::new();
let param_op_get_request: Option<models::OpGetRequest> = if !body.is_empty() {
let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
let deserializer = &mut serde_json::Deserializer::from_slice(&body);
match serde_ignored::deserialize(deserializer, |path| {
warn!("Ignoring unknown field in body: {}", path);
unused_elements.push(path.to_string());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
#![allow(unused_imports, unused_attributes)]
#![allow(clippy::derive_partial_eq_without_eq, clippy::blacklisted_name)]
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]

use async_trait::async_trait;
use futures::Stream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl<'a> std::iter::IntoIterator for &'a AnotherXmlArray {
type IntoIter = std::slice::Iter<'a, String>;

fn into_iter(self) -> Self::IntoIter {
(&self.0).iter()
self.0.iter()
}
}

Expand All @@ -120,7 +120,7 @@ impl<'a> std::iter::IntoIterator for &'a mut AnotherXmlArray {
type IntoIter = std::slice::IterMut<'a, String>;

fn into_iter(self) -> Self::IntoIter {
(&mut self.0).iter_mut()
self.0.iter_mut()
}
}

Expand Down Expand Up @@ -1499,7 +1499,7 @@ impl<'a> std::iter::IntoIterator for &'a MyIdList {
type IntoIter = std::slice::Iter<'a, i32>;

fn into_iter(self) -> Self::IntoIter {
(&self.0).iter()
self.0.iter()
}
}

Expand All @@ -1508,7 +1508,7 @@ impl<'a> std::iter::IntoIterator for &'a mut MyIdList {
type IntoIter = std::slice::IterMut<'a, i32>;

fn into_iter(self) -> Self::IntoIter {
(&mut self.0).iter_mut()
self.0.iter_mut()
}
}

Expand Down Expand Up @@ -2853,7 +2853,7 @@ impl<'a> std::iter::IntoIterator for &'a XmlArray {
type IntoIter = std::slice::Iter<'a, String>;

fn into_iter(self) -> Self::IntoIter {
(&self.0).iter()
self.0.iter()
}
}

Expand All @@ -2862,7 +2862,7 @@ impl<'a> std::iter::IntoIterator for &'a mut XmlArray {
type IntoIter = std::slice::IterMut<'a, String>;

fn into_iter(self) -> Self::IntoIter {
(&mut self.0).iter_mut()
self.0.iter_mut()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ impl<S, C> CallbackApi<C> for Client<S, C> where
});

// Header parameters
#[allow(clippy::single_match)]
match param_information {
Some(param_information) => {
request.headers_mut().append(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
hyper::Method::GET if path.matched(paths::ID_ANY_OF) => {
// Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
let param_any_of = query_params.iter().filter(|e| e.0 == "any-of").map(|e| e.1.to_owned())
let param_any_of = query_params.iter().filter(|e| e.0 == "any-of").map(|e| e.1.clone())
.filter_map(|param_any_of| param_any_of.parse().ok())
.collect::<Vec<_>>();
let param_any_of = if !param_any_of.is_empty() {
Expand Down Expand Up @@ -298,7 +298,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
hyper::Method::POST if path.matched(paths::ID_CALLBACK_WITH_HEADER) => {
// Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
let param_url = query_params.iter().filter(|e| e.0 == "url").map(|e| e.1.to_owned())
let param_url = query_params.iter().filter(|e| e.0 == "url").map(|e| e.1.clone())
.next();
let param_url = match param_url {
Some(param_url) => {
Expand Down Expand Up @@ -355,7 +355,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
hyper::Method::GET if path.matched(paths::ID_COMPLEX_QUERY_PARAM) => {
// Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
let param_list_of_strings = query_params.iter().filter(|e| e.0 == "list-of-strings").map(|e| e.1.to_owned())
let param_list_of_strings = query_params.iter().filter(|e| e.0 == "list-of-strings").map(|e| e.1.clone())
.filter_map(|param_list_of_strings| param_list_of_strings.parse().ok())
.collect::<Vec<_>>();
let param_list_of_strings = if !param_list_of_strings.is_empty() {
Expand Down Expand Up @@ -449,7 +449,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
hyper::Method::GET if path.matched(paths::ID_JSON_COMPLEX_QUERY_PARAM) => {
// Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
let param_list_of_strings = query_params.iter().filter(|e| e.0 == "list-of-strings").map(|e| e.1.to_owned())
let param_list_of_strings = query_params.iter().filter(|e| e.0 == "list-of-strings").map(|e| e.1.clone())
.next();
let param_list_of_strings = match param_list_of_strings {
Some(param_list_of_strings) => {
Expand Down Expand Up @@ -814,7 +814,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
hyper::Method::GET if path.matched(paths::ID_PARAMGET) => {
// Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
let param_uuid = query_params.iter().filter(|e| e.0 == "uuid").map(|e| e.1.to_owned())
let param_uuid = query_params.iter().filter(|e| e.0 == "uuid").map(|e| e.1.clone())
.next();
let param_uuid = match param_uuid {
Some(param_uuid) => {
Expand All @@ -831,7 +831,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
},
None => None,
};
let param_some_object = query_params.iter().filter(|e| e.0 == "someObject").map(|e| e.1.to_owned())
let param_some_object = query_params.iter().filter(|e| e.0 == "someObject").map(|e| e.1.clone())
.next();
let param_some_object = match param_some_object {
Some(param_some_object) => {
Expand All @@ -848,7 +848,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
},
None => None,
};
let param_some_list = query_params.iter().filter(|e| e.0 == "someList").map(|e| e.1.to_owned())
let param_some_list = query_params.iter().filter(|e| e.0 == "someList").map(|e| e.1.clone())
.next();
let param_some_list = match param_some_list {
Some(param_some_list) => {
Expand Down Expand Up @@ -965,7 +965,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
hyper::Method::POST if path.matched(paths::ID_REGISTER_CALLBACK) => {
// Query parameters (note that non-required or collection query parameters will ignore garbage values, rather than causing a 400 response)
let query_params = form_urlencoded::parse(uri.query().unwrap_or_default().as_bytes()).collect::<Vec<_>>();
let param_url = query_params.iter().filter(|e| e.0 == "url").map(|e| e.1.to_owned())
let param_url = query_params.iter().filter(|e| e.0 == "url").map(|e| e.1.clone())
.next();
let param_url = match param_url {
Some(param_url) => {
Expand Down Expand Up @@ -1268,7 +1268,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
Ok(body) => {
let mut unused_elements = Vec::new();
let param_object_untyped_props: Option<models::ObjectUntypedProps> = if !body.is_empty() {
let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
let deserializer = &mut serde_json::Deserializer::from_slice(&body);
match serde_ignored::deserialize(deserializer, |path| {
warn!("Ignoring unknown field in body: {}", path);
unused_elements.push(path.to_string());
Expand Down Expand Up @@ -1713,7 +1713,7 @@ impl<T, C> hyper::service::Service<(Request<Body>, C)> for Service<T, C> where
Ok(body) => {
let mut unused_elements = Vec::new();
let param_object_param: Option<models::ObjectParam> = if !body.is_empty() {
let deserializer = &mut serde_json::Deserializer::from_slice(&*body);
let deserializer = &mut serde_json::Deserializer::from_slice(&body);
match serde_ignored::deserialize(deserializer, |path| {
warn!("Ignoring unknown field in body: {}", path);
unused_elements.push(path.to_string());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
#![allow(unused_imports, unused_attributes)]
#![allow(clippy::derive_partial_eq_without_eq, clippy::blacklisted_name)]
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]

use async_trait::async_trait;
use futures::Stream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1442,6 +1442,7 @@ impl<S, C> Api<C> for Client<S, C> where
});

// Header parameters
#[allow(clippy::single_match)]
match param_enum_header_string_array {
Some(param_enum_header_string_array) => {
request.headers_mut().append(
Expand All @@ -1458,6 +1459,7 @@ impl<S, C> Api<C> for Client<S, C> where
None => {}
}

#[allow(clippy::single_match)]
match param_enum_header_string {
Some(param_enum_header_string) => {
request.headers_mut().append(
Expand Down Expand Up @@ -1927,6 +1929,7 @@ impl<S, C> Api<C> for Client<S, C> where
}

// Header parameters
#[allow(clippy::single_match)]
match param_api_key {
Some(param_api_key) => {
request.headers_mut().append(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
#![allow(unused_imports, unused_attributes)]
#![allow(clippy::derive_partial_eq_without_eq, clippy::blacklisted_name)]
#![allow(clippy::derive_partial_eq_without_eq, clippy::disallowed_names)]

use async_trait::async_trait;
use futures::Stream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ impl<'a> std::iter::IntoIterator for &'a AnimalFarm {
type IntoIter = std::slice::Iter<'a, Animal>;

fn into_iter(self) -> Self::IntoIter {
(&self.0).iter()
self.0.iter()
}
}

Expand All @@ -331,7 +331,7 @@ impl<'a> std::iter::IntoIterator for &'a mut AnimalFarm {
type IntoIter = std::slice::IterMut<'a, Animal>;

fn into_iter(self) -> Self::IntoIter {
(&mut self.0).iter_mut()
self.0.iter_mut()
}
}

Expand Down
Loading