Fixed redundant_closure_for_method_calls
https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
This commit is contained in:
parent
2d7f5fd772
commit
baf67f3344
|
@ -85,7 +85,8 @@ pub(super) async fn receive_batch_multipart(
|
|||
_ => {
|
||||
if let Some(name) = field.name().map(ToString::to_string) {
|
||||
if let Some(filename) = field.file_name().map(ToString::to_string) {
|
||||
let content_type = field.content_type().map(|mime| mime.to_string());
|
||||
let content_type =
|
||||
field.content_type().map(std::string::ToString::to_string);
|
||||
let mut file = tempfile::tempfile().map_err(ParseRequestError::Io)?;
|
||||
while let Some(chunk) = field.chunk().await.unwrap() {
|
||||
file.write(&chunk).map_err(ParseRequestError::Io)?;
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
#![allow(clippy::must_use_candidate)]
|
||||
#![allow(clippy::missing_errors_doc)]
|
||||
#![allow(clippy::needless_pass_by_value)]
|
||||
#![allow(clippy::redundant_closure_for_method_calls)]
|
||||
#![deny(clippy::redundant_closure_for_method_calls)]
|
||||
#![allow(clippy::option_if_let_else)]
|
||||
#![allow(clippy::match_same_arms)]
|
||||
#![allow(clippy::filter_map)]
|
||||
|
|
|
@ -79,7 +79,9 @@ impl<'a> __Directive<'a> {
|
|||
}
|
||||
|
||||
async fn description(&self) -> Option<String> {
|
||||
self.directive.description.map(|s| s.to_string())
|
||||
self.directive
|
||||
.description
|
||||
.map(std::string::ToString::to_string)
|
||||
}
|
||||
|
||||
async fn locations(&self) -> &Vec<__DirectiveLocation> {
|
||||
|
|
|
@ -13,7 +13,7 @@ impl<'a> __EnumValue<'a> {
|
|||
}
|
||||
|
||||
async fn description(&self) -> Option<String> {
|
||||
self.value.description.map(|s| s.to_string())
|
||||
self.value.description.map(std::string::ToString::to_string)
|
||||
}
|
||||
|
||||
async fn is_deprecated(&self) -> bool {
|
||||
|
@ -21,6 +21,6 @@ impl<'a> __EnumValue<'a> {
|
|||
}
|
||||
|
||||
async fn deprecation_reason(&self) -> Option<String> {
|
||||
self.value.deprecation.map(|s| s.to_string())
|
||||
self.value.deprecation.map(std::string::ToString::to_string)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ impl<'a> __Field<'a> {
|
|||
}
|
||||
|
||||
async fn description(&self) -> Option<String> {
|
||||
self.field.description.map(|s| s.to_string())
|
||||
self.field.description.map(std::string::ToString::to_string)
|
||||
}
|
||||
|
||||
async fn args(&self) -> Vec<__InputValue<'a>> {
|
||||
|
@ -38,6 +38,6 @@ impl<'a> __Field<'a> {
|
|||
}
|
||||
|
||||
async fn deprecation_reason(&self) -> Option<String> {
|
||||
self.field.deprecation.map(|s| s.to_string())
|
||||
self.field.deprecation.map(std::string::ToString::to_string)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,9 @@ impl<'a> __InputValue<'a> {
|
|||
}
|
||||
|
||||
async fn description(&self) -> Option<String> {
|
||||
self.input_value.description.map(|s| s.to_string())
|
||||
self.input_value
|
||||
.description
|
||||
.map(std::string::ToString::to_string)
|
||||
}
|
||||
|
||||
#[graphql(name = "type")]
|
||||
|
|
|
@ -70,18 +70,22 @@ impl<'a> __Type<'a> {
|
|||
match &self.detail {
|
||||
TypeDetail::Named(ty) => match ty {
|
||||
registry::MetaType::Scalar { description, .. } => {
|
||||
description.map(|s| s.to_string())
|
||||
description.map(std::string::ToString::to_string)
|
||||
}
|
||||
registry::MetaType::Object { description, .. } => {
|
||||
description.map(|s| s.to_string())
|
||||
description.map(std::string::ToString::to_string)
|
||||
}
|
||||
registry::MetaType::Interface { description, .. } => {
|
||||
description.map(|s| s.to_string())
|
||||
description.map(std::string::ToString::to_string)
|
||||
}
|
||||
registry::MetaType::Union { description, .. } => {
|
||||
description.map(std::string::ToString::to_string)
|
||||
}
|
||||
registry::MetaType::Enum { description, .. } => {
|
||||
description.map(std::string::ToString::to_string)
|
||||
}
|
||||
registry::MetaType::Union { description, .. } => description.map(|s| s.to_string()),
|
||||
registry::MetaType::Enum { description, .. } => description.map(|s| s.to_string()),
|
||||
registry::MetaType::InputObject { description, .. } => {
|
||||
description.map(|s| s.to_string())
|
||||
description.map(std::string::ToString::to_string)
|
||||
}
|
||||
},
|
||||
TypeDetail::NonNull(_) => None,
|
||||
|
|
|
@ -40,7 +40,7 @@ impl<'a> Visitor<'a> for FieldsOnCorrectType {
|
|||
.iter()
|
||||
.map(|fields| fields.keys())
|
||||
.flatten()
|
||||
.map(|s| s.as_str()),
|
||||
.map(std::string::String::as_str),
|
||||
&field.node.name.node,
|
||||
)
|
||||
.unwrap_or_default()
|
||||
|
|
|
@ -80,7 +80,7 @@ impl<'a> Visitor<'a> for NoUndefinedVariables<'a> {
|
|||
name: Option<&'a Name>,
|
||||
operation_definition: &'a Positioned<OperationDefinition>,
|
||||
) {
|
||||
let name = name.map(|name| name.as_str());
|
||||
let name = name.map(async_graphql_value::Name::as_str);
|
||||
self.current_scope = Some(Scope::Operation(name));
|
||||
self.defined_variables
|
||||
.insert(name, (operation_definition.pos, HashSet::new()));
|
||||
|
|
|
@ -38,7 +38,7 @@ impl<'a> Visitor<'a> for NoUnusedFragments<'a> {
|
|||
|
||||
for (name, _) in doc.operations.iter() {
|
||||
self.find_reachable_fragments(
|
||||
&Scope::Operation(name.map(|name| name.as_str())),
|
||||
&Scope::Operation(name.map(Name::as_str)),
|
||||
&mut reachable,
|
||||
);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ impl<'a> Visitor<'a> for NoUnusedFragments<'a> {
|
|||
name: Option<&'a Name>,
|
||||
_operation_definition: &'a Positioned<OperationDefinition>,
|
||||
) {
|
||||
self.current_scope = Some(Scope::Operation(name.map(|name| name.as_str())));
|
||||
self.current_scope = Some(Scope::Operation(name.map(Name::as_str)));
|
||||
}
|
||||
|
||||
fn enter_fragment_definition(
|
||||
|
|
|
@ -80,7 +80,7 @@ impl<'a> Visitor<'a> for NoUnusedVariables<'a> {
|
|||
name: Option<&'a Name>,
|
||||
_operation_definition: &'a Positioned<OperationDefinition>,
|
||||
) {
|
||||
let op_name = name.map(|name| name.as_str());
|
||||
let op_name = name.map(Name::as_str);
|
||||
self.current_scope = Some(Scope::Operation(op_name));
|
||||
self.defined_variables.insert(op_name, HashSet::new());
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ impl<'a> Visitor<'a> for VariableInAllowedPosition<'a> {
|
|||
name: Option<&'a Name>,
|
||||
_operation_definition: &'a Positioned<OperationDefinition>,
|
||||
) {
|
||||
self.current_scope = Some(Scope::Operation(name.map(|name| name.as_str())));
|
||||
self.current_scope = Some(Scope::Operation(name.map(Name::as_str)));
|
||||
}
|
||||
|
||||
fn enter_fragment_definition(
|
||||
|
|
|
@ -124,7 +124,7 @@ pub fn is_valid_input_value(
|
|||
ConstValue::Object(values) => {
|
||||
let mut input_names = values
|
||||
.keys()
|
||||
.map(|name| name.as_ref())
|
||||
.map(std::convert::AsRef::as_ref)
|
||||
.collect::<HashSet<_>>();
|
||||
|
||||
for field in input_fields.values() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user