@@ -57,7 +57,7 @@ impl OperationDefinitionExtension for OperationDefinition {
5757 fn selection_set ( & self ) -> & SelectionSet {
5858 match self {
5959 OperationDefinition :: Query ( query) => & query. selection_set ,
60- OperationDefinition :: SelectionSet ( selection_set) => & selection_set,
60+ OperationDefinition :: SelectionSet ( selection_set) => selection_set,
6161 OperationDefinition :: Mutation ( mutation) => & mutation. selection_set ,
6262 OperationDefinition :: Subscription ( subscription) => & subscription. selection_set ,
6363 }
@@ -156,7 +156,7 @@ impl SchemaDocumentExtension for schema::Document {
156156 self . schema_definition ( )
157157 . subscription
158158 . as_ref ( )
159- . and_then ( |name| self . object_type_by_name ( & name) )
159+ . and_then ( |name| self . object_type_by_name ( name) )
160160 }
161161
162162 fn object_type_by_name ( & self , name : & str ) -> Option < & ObjectType > {
@@ -185,7 +185,7 @@ impl SchemaDocumentExtension for schema::Document {
185185 self . type_by_name ( sub_type_name) ,
186186 self . type_by_name ( super_type_name) ,
187187 ) {
188- super_type. is_abstract_type ( ) && self . is_possible_type ( & super_type, & sub_type)
188+ super_type. is_abstract_type ( ) && self . is_possible_type ( super_type, sub_type)
189189 } else {
190190 false
191191 }
@@ -206,7 +206,7 @@ impl SchemaDocumentExtension for schema::Document {
206206 TypeDefinition :: Interface ( interface_typedef) => {
207207 let implementes_interfaces = possible_type. interfaces ( ) ;
208208
209- return implementes_interfaces. contains ( & interface_typedef. name ) ;
209+ implementes_interfaces. contains ( & interface_typedef. name )
210210 }
211211 _ => false ,
212212 }
@@ -248,12 +248,12 @@ impl SchemaDocumentExtension for schema::Document {
248248 // If superType type is an abstract type, check if it is super type of maybeSubType.
249249 // Otherwise, the child type is not a valid subtype of the parent type.
250250 if let ( Some ( sub_type) , Some ( super_type) ) = (
251- self . type_by_name ( & sub_type. inner_type ( ) ) ,
252- self . type_by_name ( & super_type. inner_type ( ) ) ,
251+ self . type_by_name ( sub_type. inner_type ( ) ) ,
252+ self . type_by_name ( super_type. inner_type ( ) ) ,
253253 ) {
254254 return super_type. is_abstract_type ( )
255255 && ( sub_type. is_interface_type ( ) || sub_type. is_object_type ( ) )
256- && self . is_possible_type ( & super_type, & sub_type) ;
256+ && self . is_possible_type ( super_type, sub_type) ;
257257 }
258258
259259 false
@@ -350,7 +350,7 @@ pub trait InputValueHelpers {
350350impl InputValueHelpers for InputValue {
351351 fn is_required ( & self ) -> bool {
352352 if let Type :: NonNullType ( _inner_type) = & self . value_type {
353- if let None = & self . default_value {
353+ if self . default_value . is_none ( ) {
354354 return true ;
355355 }
356356 }
@@ -394,22 +394,20 @@ impl ImplementingInterfaceExtension for TypeDefinition {
394394 fn has_sub_type ( & self , other_type : & TypeDefinition ) -> bool {
395395 match self {
396396 TypeDefinition :: Interface ( interface_type) => {
397- return interface_type. is_implemented_by ( other_type)
397+ interface_type. is_implemented_by ( other_type)
398398 }
399399 TypeDefinition :: Union ( union_type) => return union_type. has_sub_type ( other_type. name ( ) ) ,
400- _ => return false ,
400+ _ => false ,
401401 }
402402 }
403403
404404 fn has_concrete_sub_type ( & self , concrete_type : & ObjectType ) -> bool {
405405 match self {
406406 TypeDefinition :: Interface ( interface_type) => {
407- return interface_type. is_implemented_by ( concrete_type)
408- }
409- TypeDefinition :: Union ( union_type) => {
410- return union_type. has_sub_type ( & concrete_type. name )
407+ interface_type. is_implemented_by ( concrete_type)
411408 }
412- _ => return false ,
409+ TypeDefinition :: Union ( union_type) => union_type. has_sub_type ( & concrete_type. name ) ,
410+ _ => false ,
413411 }
414412 }
415413}
@@ -487,17 +485,13 @@ pub trait SubTypeExtension {
487485
488486impl SubTypeExtension for UnionType {
489487 fn has_sub_type ( & self , other_type_name : & str ) -> bool {
490- self . types . iter ( ) . find ( |v| other_type_name. eq ( * v ) ) . is_some ( )
488+ self . types . iter ( ) . any ( |v| other_type_name. eq ( v ) )
491489 }
492490}
493491
494492impl AbstractTypeDefinitionExtension for InterfaceType {
495493 fn is_implemented_by ( & self , other_type : & dyn ImplementingInterfaceExtension ) -> bool {
496- other_type
497- . interfaces ( )
498- . iter ( )
499- . find ( |v| self . name . eq ( * v) )
500- . is_some ( )
494+ other_type. interfaces ( ) . iter ( ) . any ( |v| self . name . eq ( v) )
501495 }
502496}
503497
0 commit comments