@@ -319,7 +319,7 @@ impl<'program> RequiredDirective<'program> {
319319 }
320320}
321321
322- impl < ' s > Transformer < ' _ > for RequiredDirective < ' s > {
322+ impl Transformer < ' _ > for RequiredDirective < ' _ > {
323323 const NAME : & ' static str = "RequiredDirectiveTransform" ;
324324 const VISIT_ARGUMENTS : bool = false ;
325325 const VISIT_DIRECTIVES : bool = false ;
@@ -592,21 +592,26 @@ struct RequiredDirectiveVisitor<'s> {
592592 visited_fragments : FragmentDefinitionNameMap < bool > ,
593593}
594594
595- impl < ' s > DirectiveFinder for RequiredDirectiveVisitor < ' s > {
595+ impl DirectiveFinder for RequiredDirectiveVisitor < ' _ > {
596596 fn visit_directive ( & self , directive : & Directive ) -> bool {
597597 directive. name . item == * REQUIRED_DIRECTIVE_NAME
598598 }
599599
600600 fn visit_fragment_spread ( & mut self , fragment_spread : & graphql_ir:: FragmentSpread ) -> bool {
601- let fragment = self
602- . program
603- . fragment ( fragment_spread. fragment . item )
604- . unwrap ( ) ;
605- self . visit_fragment ( fragment)
601+ let fragment = self . program . fragment ( fragment_spread. fragment . item ) ;
602+ if let Some ( frag) = fragment {
603+ self . visit_fragment ( frag)
604+ } else {
605+ println ! (
606+ "required_directive: Could not find fragment for fragment spread: {}" ,
607+ fragment_spread. fragment. item
608+ ) ;
609+ false
610+ }
606611 }
607612}
608613
609- impl < ' s > RequiredDirectiveVisitor < ' s > {
614+ impl RequiredDirectiveVisitor < ' _ > {
610615 fn visit_fragment ( & mut self , fragment : & FragmentDefinition ) -> bool {
611616 if let Some ( val) = self . visited_fragments . get ( & fragment. name . item ) {
612617 return * val;
0 commit comments