@@ -400,13 +400,13 @@ impl StoredInputType {
400
400
}
401
401
}
402
402
403
- fn contains_type_without_indirection (
404
- & self ,
403
+ fn contains_type_without_indirection < ' a > (
404
+ & ' a self ,
405
405
input_id : InputId ,
406
- schema : & Schema ,
407
- visited_types : & mut HashSet < String > ,
406
+ schema : & ' a Schema ,
407
+ visited_types : & mut HashSet < & ' a str > ,
408
408
) -> bool {
409
- visited_types. insert ( self . name . clone ( ) ) ;
409
+ visited_types. insert ( & self . name ) ;
410
410
// The input type is recursive if any of its members contains it, without indirection
411
411
self . fields . iter ( ) . any ( |( _name, field_type) | {
412
412
// the field is indirected, so no boxing is needed
@@ -424,8 +424,8 @@ impl StoredInputType {
424
424
let input = schema. get_input ( field_input_id) ;
425
425
426
426
// no need to visit type twice (prevents infinite recursion)
427
- if visited_types. contains ( & input. name ) {
428
- return true ;
427
+ if visited_types. contains ( & input. name . as_str ( ) ) {
428
+ return false ;
429
429
}
430
430
431
431
// we check if the other input contains this one (without indirection)
@@ -440,7 +440,7 @@ impl StoredInputType {
440
440
441
441
pub ( crate ) fn input_is_recursive_without_indirection ( input_id : InputId , schema : & Schema ) -> bool {
442
442
let input = schema. get_input ( input_id) ;
443
- let mut visited_types = HashSet :: < String > :: new ( ) ;
443
+ let mut visited_types = HashSet :: < & str > :: new ( ) ;
444
444
input. contains_type_without_indirection ( input_id, schema, & mut visited_types)
445
445
}
446
446
impl std:: convert:: From < graphql_parser:: schema:: Document > for Schema {
0 commit comments