@@ -188,6 +188,7 @@ pub enum DirectiveLocation {
188188 FragmentDefinition ,
189189 FragmentSpread ,
190190 InlineFragment ,
191+
191192 // type_system
192193 Schema ,
193194 Scalar ,
@@ -212,7 +213,7 @@ pub struct DirectiveDefinition {
212213}
213214
214215impl DirectiveLocation {
215- /// Returns graphql syntax compatible name of the directive
216+ /// Returns GraphQL syntax compatible name of the directive
216217 pub fn as_str ( & self ) -> & ' static str {
217218 use self :: DirectiveLocation :: * ;
218219 match * self {
@@ -236,53 +237,38 @@ impl DirectiveLocation {
236237 InputFieldDefinition => "INPUT_FIELD_DEFINITION" ,
237238 }
238239 }
239- /// Returns true if this location is for queries (execution)
240+
241+ /// Returns `true` if this location is for queries (execution)
240242 pub fn is_query ( & self ) -> bool {
241243 use self :: DirectiveLocation :: * ;
242244 match * self {
243- Query => true ,
244- Mutation => true ,
245- Subscription => true ,
246- Field => true ,
247- FragmentDefinition => true ,
248- FragmentSpread => true ,
249- InlineFragment => true ,
250- Schema => false ,
251- Scalar => false ,
252- Object => false ,
253- FieldDefinition => false ,
254- ArgumentDefinition => false ,
255- Interface => false ,
256- Union => false ,
257- Enum => false ,
258- EnumValue => false ,
259- InputObject => false ,
260- InputFieldDefinition => false ,
245+ Query
246+ | Mutation
247+ | Subscription
248+ | Field
249+ | FragmentDefinition
250+ | FragmentSpread
251+ | InlineFragment
252+ => true ,
253+
254+ Schema
255+ | Scalar
256+ | Object
257+ | FieldDefinition
258+ | ArgumentDefinition
259+ | Interface
260+ | Union
261+ | Enum
262+ | EnumValue
263+ | InputObject
264+ | InputFieldDefinition
265+ => false ,
261266 }
262267 }
263- /// Returns true if this location is for schema
268+
269+ /// Returns `true` if this location is for schema
264270 pub fn is_schema ( & self ) -> bool {
265- use self :: DirectiveLocation :: * ;
266- match * self {
267- Query => false ,
268- Mutation => false ,
269- Subscription => false ,
270- Field => false ,
271- FragmentDefinition => false ,
272- FragmentSpread => false ,
273- InlineFragment => false ,
274- Schema => true ,
275- Scalar => true ,
276- Object => true ,
277- FieldDefinition => true ,
278- ArgumentDefinition => true ,
279- Interface => true ,
280- Union => true ,
281- Enum => true ,
282- EnumValue => true ,
283- InputObject => true ,
284- InputFieldDefinition => true ,
285- }
271+ !self . is_query ( )
286272 }
287273}
288274
@@ -317,6 +303,7 @@ impl FromStr for DirectiveLocation {
317303 "INPUT_FIELD_DEFINITION" => InputFieldDefinition ,
318304 _ => return Err ( InvalidDirectiveLocation ) ,
319305 } ;
320- return Ok ( val) ;
306+
307+ Ok ( val)
321308 }
322309}
0 commit comments