Clippy clean

This commit is contained in:
Sunli 2022-04-28 12:14:23 +08:00
parent f2e25c9f4a
commit 7707a45eaa
7 changed files with 2265 additions and 2078 deletions

View File

@ -1,12 +1,12 @@
edition = "2021"
newline_style = "unix"
newline_style = "Unix"
# comments
normalize_comments=true
wrap_comments=true
format_code_in_doc_comments=true
normalize_comments = true
wrap_comments = true
format_code_in_doc_comments = true
# imports
imports_granularity="Crate"
group_imports="StdExternalCrate"
imports_granularity = "Crate"
group_imports = "StdExternalCrate"
# report
#report_fixme="Unnumbered"
#report_todo="Unnumbered"

View File

@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add `bson-uuid` feature to implement `ScalarType` for `bson::Uuid`. [#875](https://github.com/async-graphql/async-graphql/pull/875)
- Bump `regex` crate from `1.4.5` to `1.5.5`. [#862](https://github.com/async-graphql/async-graphql/pull/862)
- Bump `chrono-tz` crate from `0.5.3` to `0.6.1`. [#831](https://github.com/async-graphql/async-graphql/pull/831)
- Move the pest parser code generation step into a test. [#901](https://github.com/async-graphql/async-graphql/pull/901)
- Update `log` to version `0.4.16`. [#903](https://github.com/async-graphql/async-graphql/pull/903)
- Added impl of `CursorType` for floats [#897](https://github.com/async-graphql/async-graphql/pull/897)
# [3.0.38] 2022-4-8

View File

@ -5,7 +5,7 @@ use super::GraphQLParser;
#[allow(non_upper_case_globals)]
const _PEST_GRAMMAR_GraphQLParser: &'static str =
include_str!("/Users/djc/src/async-graphql/parser/src/graphql.pest");
include_str!("/Users/sunli/work/async-graphql/parser/src/graphql.pest");
#[allow(dead_code, non_camel_case_types)]
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum Rule {
@ -109,8 +109,11 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::visible::COMMENT(state)
.and_then(|state| state.repeat(|state| super::visible::WHITESPACE(state)))
super::visible::COMMENT(state).and_then(|state| {
state.repeat(|state| {
super::visible::WHITESPACE(state)
})
})
})
})
})
@ -185,14 +188,16 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| {
state.sequence(|state| {
state.optional(|state| {
self::executable_definition(state).and_then(|state| {
self::executable_definition(state).and_then(
|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state)
.and_then(|state| self::executable_definition(state))
})
})
})
},
)
})
})
})
@ -209,7 +214,8 @@ impl ::pest::Parser<Rule> for GraphQLParser {
state: Box<::pest::ParserState<Rule>>,
) -> ::pest::ParseResult<Box<::pest::ParserState<Rule>>> {
state.rule(Rule::executable_definition, |state| {
self::operation_definition(state).or_else(|state| self::fragment_definition(state))
self::operation_definition(state)
.or_else(|state| self::fragment_definition(state))
})
}
#[inline]
@ -218,7 +224,8 @@ impl ::pest::Parser<Rule> for GraphQLParser {
state: Box<::pest::ParserState<Rule>>,
) -> ::pest::ParseResult<Box<::pest::ParserState<Rule>>> {
state.rule(Rule::operation_definition, |state| {
self::named_operation_definition(state).or_else(|state| self::selection_set(state))
self::named_operation_definition(state)
.or_else(|state| self::selection_set(state))
})
}
#[inline]
@ -232,7 +239,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::name(state)))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::variable_definitions(state)))
.and_then(|state| {
state.optional(|state| self::variable_definitions(state))
})
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::directives(state)))
.and_then(|state| super::hidden::skip(state))
@ -256,8 +265,11 @@ impl ::pest::Parser<Rule> for GraphQLParser {
self::variable_definition(state).and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state)
.and_then(|state| self::variable_definition(state))
super::hidden::skip(state).and_then(
|state| {
self::variable_definition(state)
},
)
})
})
})
@ -284,7 +296,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::directives(state)))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::default_value(state)))
.and_then(|state| {
state.optional(|state| self::default_value(state))
})
})
})
}
@ -309,7 +323,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state)
.and_then(|state| self::selection(state))
.and_then(|state| {
self::selection(state)
})
})
})
})
@ -350,7 +366,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::directives(state)))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::selection_set(state)))
.and_then(|state| {
state.optional(|state| self::selection_set(state))
})
})
})
}
@ -393,7 +411,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
state
.match_string("...")
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::type_condition(state)))
.and_then(|state| {
state.optional(|state| self::type_condition(state))
})
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::directives(state)))
.and_then(|state| super::hidden::skip(state))
@ -451,7 +471,8 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| {
state.sequence(|state| {
state.optional(|state| {
self::type_system_definition(state).and_then(|state| {
self::type_system_definition(state)
.and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state)
@ -491,7 +512,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
state
.match_string("schema")
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::const_directives(state)))
.and_then(|state| {
state.optional(|state| self::const_directives(state))
})
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.match_string("{"))
.and_then(|state| super::hidden::skip(state))
@ -502,7 +525,8 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| {
state.sequence(|state| {
state.optional(|state| {
self::operation_type_definition(state).and_then(|state| {
self::operation_type_definition(state)
.and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state)
@ -528,14 +552,24 @@ impl ::pest::Parser<Rule> for GraphQLParser {
state
.sequence(|state| {
state
.optional(|state| self::const_directives(state))
.and_then(|state| super::hidden::skip(state))
.optional(|state| {
self::const_directives(state)
})
.and_then(|state| {
super::hidden::skip(state)
})
.and_then(|state| state.match_string("{"))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| {
super::hidden::skip(state)
})
.and_then(|state| {
state.sequence(|state| {
self::operation_type_definition(state)
.and_then(|state| super::hidden::skip(state))
self::operation_type_definition(
state,
)
.and_then(|state| {
super::hidden::skip(state)
})
.and_then(|state| {
state.sequence(|state| {
state.optional(|state| {
@ -553,7 +587,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
})
})
})
.and_then(|state| super::hidden::skip(state))
.and_then(|state| {
super::hidden::skip(state)
})
.and_then(|state| state.match_string("}"))
})
.or_else(|state| self::const_directives(state))
@ -606,7 +642,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::name(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::const_directives(state)))
.and_then(|state| {
state.optional(|state| self::const_directives(state))
})
})
.or_else(|state| {
state.sequence(|state| {
@ -636,11 +674,17 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::name(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::implements_interfaces(state)))
.and_then(|state| {
state.optional(|state| self::implements_interfaces(state))
})
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::const_directives(state)))
.and_then(|state| {
state.optional(|state| self::const_directives(state))
})
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::fields_definition(state)))
.and_then(|state| {
state.optional(|state| self::fields_definition(state))
})
})
.or_else(|state| {
state.sequence(|state| {
@ -654,17 +698,35 @@ impl ::pest::Parser<Rule> for GraphQLParser {
state
.sequence(|state| {
state
.optional(|state| self::implements_interfaces(state))
.and_then(|state| super::hidden::skip(state))
.optional(|state| {
self::implements_interfaces(state)
})
.and_then(|state| {
super::hidden::skip(state)
})
.and_then(|state| {
state
.sequence(|state| {
state
.optional(|state| self::const_directives(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::fields_definition(state))
.optional(|state| {
self::const_directives(
state,
)
})
.and_then(|state| {
super::hidden::skip(
state,
)
})
.and_then(|state| {
self::fields_definition(
state,
)
})
})
.or_else(|state| {
self::const_directives(state)
})
.or_else(|state| self::const_directives(state))
})
})
.or_else(|state| self::implements_interfaces(state))
@ -694,20 +756,30 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.sequence(|state| {
state
.match_string("&")
.and_then(|state| super::hidden::skip(state))
.and_then(|state| {
super::hidden::skip(state)
})
.and_then(|state| self::name(state))
})
.and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state).and_then(|state| {
super::hidden::skip(state).and_then(
|state| {
state.sequence(|state| {
state
.match_string("&")
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::name(state))
.and_then(|state| {
super::hidden::skip(
state,
)
})
.and_then(|state| {
self::name(state)
})
})
},
)
})
})
})
@ -732,11 +804,17 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::name(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::implements_interfaces(state)))
.and_then(|state| {
state.optional(|state| self::implements_interfaces(state))
})
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::const_directives(state)))
.and_then(|state| {
state.optional(|state| self::const_directives(state))
})
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::fields_definition(state)))
.and_then(|state| {
state.optional(|state| self::fields_definition(state))
})
})
.or_else(|state| {
state.sequence(|state| {
@ -746,15 +824,25 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::name(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::implements_interfaces(state)))
.and_then(|state| {
state.optional(|state| {
self::implements_interfaces(state)
})
})
.and_then(|state| super::hidden::skip(state))
.and_then(|state| {
state
.sequence(|state| {
state
.optional(|state| self::const_directives(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::fields_definition(state))
.optional(|state| {
self::const_directives(state)
})
.and_then(|state| {
super::hidden::skip(state)
})
.and_then(|state| {
self::fields_definition(state)
})
})
.or_else(|state| self::const_directives(state))
})
@ -779,14 +867,16 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| {
state.sequence(|state| {
state.optional(|state| {
self::field_definition(state).and_then(|state| {
self::field_definition(state).and_then(
|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state)
.and_then(|state| self::field_definition(state))
})
})
})
},
)
})
})
})
@ -809,13 +899,17 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::name(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::arguments_definition(state)))
.and_then(|state| {
state.optional(|state| self::arguments_definition(state))
})
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.match_string(":"))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::type_(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::const_directives(state)))
.and_then(|state| {
state.optional(|state| self::const_directives(state))
})
})
})
}
@ -834,9 +928,13 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::name(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::const_directives(state)))
.and_then(|state| {
state.optional(|state| self::const_directives(state))
})
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::union_member_types(state)))
.and_then(|state| {
state.optional(|state| self::union_member_types(state))
})
})
.or_else(|state| {
state.sequence(|state| {
@ -850,9 +948,15 @@ impl ::pest::Parser<Rule> for GraphQLParser {
state
.sequence(|state| {
state
.optional(|state| self::const_directives(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::union_member_types(state))
.optional(|state| {
self::const_directives(state)
})
.and_then(|state| {
super::hidden::skip(state)
})
.and_then(|state| {
self::union_member_types(state)
})
})
.or_else(|state| self::const_directives(state))
})
@ -881,20 +985,30 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.sequence(|state| {
state
.match_string("|")
.and_then(|state| super::hidden::skip(state))
.and_then(|state| {
super::hidden::skip(state)
})
.and_then(|state| self::name(state))
})
.and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state).and_then(|state| {
super::hidden::skip(state).and_then(
|state| {
state.sequence(|state| {
state
.match_string("|")
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::name(state))
.and_then(|state| {
super::hidden::skip(
state,
)
})
.and_then(|state| {
self::name(state)
})
})
},
)
})
})
})
@ -919,9 +1033,13 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::name(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::const_directives(state)))
.and_then(|state| {
state.optional(|state| self::const_directives(state))
})
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::enum_values(state)))
.and_then(|state| {
state.optional(|state| self::enum_values(state))
})
})
.or_else(|state| {
state.sequence(|state| {
@ -935,8 +1053,12 @@ impl ::pest::Parser<Rule> for GraphQLParser {
state
.sequence(|state| {
state
.optional(|state| self::const_directives(state))
.and_then(|state| super::hidden::skip(state))
.optional(|state| {
self::const_directives(state)
})
.and_then(|state| {
super::hidden::skip(state)
})
.and_then(|state| self::enum_values(state))
})
.or_else(|state| self::const_directives(state))
@ -962,14 +1084,16 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| {
state.sequence(|state| {
state.optional(|state| {
self::enum_value_definition(state).and_then(|state| {
self::enum_value_definition(state).and_then(
|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state)
.and_then(|state| self::enum_value_definition(state))
})
})
})
},
)
})
})
})
@ -992,7 +1116,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::enum_value(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::const_directives(state)))
.and_then(|state| {
state.optional(|state| self::const_directives(state))
})
})
})
}
@ -1011,9 +1137,13 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::name(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::const_directives(state)))
.and_then(|state| {
state.optional(|state| self::const_directives(state))
})
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::input_fields_definition(state)))
.and_then(|state| {
state.optional(|state| self::input_fields_definition(state))
})
})
.or_else(|state| {
state.sequence(|state| {
@ -1027,9 +1157,15 @@ impl ::pest::Parser<Rule> for GraphQLParser {
state
.sequence(|state| {
state
.optional(|state| self::const_directives(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::input_fields_definition(state))
.optional(|state| {
self::const_directives(state)
})
.and_then(|state| {
super::hidden::skip(state)
})
.and_then(|state| {
self::input_fields_definition(state)
})
})
.or_else(|state| self::const_directives(state))
})
@ -1054,7 +1190,8 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| {
state.sequence(|state| {
state.optional(|state| {
self::input_value_definition(state).and_then(|state| {
self::input_value_definition(state)
.and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state)
@ -1095,7 +1232,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::name(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::arguments_definition(state)))
.and_then(|state| {
state.optional(|state| self::arguments_definition(state))
})
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.match_string("on"))
.and_then(|state| super::hidden::skip(state))
@ -1122,20 +1261,26 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.sequence(|state| {
state
.match_string("|")
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::directive_location(state))
.and_then(|state| {
super::hidden::skip(state)
})
.and_then(|state| {
self::directive_location(state)
})
})
.and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state).and_then(|state| {
super::hidden::skip(state).and_then(
|state| {
state.sequence(|state| {
state
.match_string("|")
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::directive_location(state))
})
})
},
)
})
})
})
@ -1190,7 +1335,8 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| {
state.sequence(|state| {
state.optional(|state| {
self::input_value_definition(state).and_then(|state| {
self::input_value_definition(state)
.and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state)
@ -1224,9 +1370,13 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::type_(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::default_value(state)))
.and_then(|state| {
state.optional(|state| self::default_value(state))
})
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::const_directives(state)))
.and_then(|state| {
state.optional(|state| self::const_directives(state))
})
})
})
}
@ -1273,7 +1423,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| state.match_string("]"))
})
})
.and_then(|state| state.optional(|state| state.match_string("!")))
.and_then(|state| {
state.optional(|state| state.match_string("!"))
})
})
})
})
@ -1333,7 +1485,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
state.sequence(|state| {
self::float(state)
.or_else(|state| self::int(state))
.and_then(|state| state.lookahead(false, |state| self::name_start(state)))
.and_then(|state| {
state.lookahead(false, |state| self::name_start(state))
})
})
})
})
@ -1378,7 +1532,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
self::ASCII_DIGIT(state).and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state).and_then(|state| self::ASCII_DIGIT(state))
super::hidden::skip(state).and_then(
|state| self::ASCII_DIGIT(state),
)
})
})
})
@ -1415,7 +1571,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
self::ASCII_DIGIT(state).and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state).and_then(|state| self::ASCII_DIGIT(state))
super::hidden::skip(state).and_then(
|state| self::ASCII_DIGIT(state),
)
})
})
})
@ -1443,14 +1601,22 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| {
state.sequence(|state| {
state.optional(|state| {
self::ASCII_DIGIT(state).and_then(|state| {
self::ASCII_DIGIT(state).and_then(
|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state)
.and_then(|state| self::ASCII_DIGIT(state))
super::hidden::skip(
state,
)
.and_then(|state| {
self::ASCII_DIGIT(
state,
)
})
})
})
},
)
})
})
})
@ -1656,7 +1822,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
self::const_value(state).and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state).and_then(|state| self::const_value(state))
super::hidden::skip(state).and_then(
|state| self::const_value(state),
)
})
})
})
@ -1684,7 +1852,8 @@ impl ::pest::Parser<Rule> for GraphQLParser {
self::value(state).and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state).and_then(|state| self::value(state))
super::hidden::skip(state)
.and_then(|state| self::value(state))
})
})
})
@ -1712,8 +1881,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
self::const_object_field(state).and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state)
.and_then(|state| self::const_object_field(state))
super::hidden::skip(state).and_then(
|state| self::const_object_field(state),
)
})
})
})
@ -1741,7 +1911,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
self::object_field(state).and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state).and_then(|state| self::object_field(state))
super::hidden::skip(state).and_then(
|state| self::object_field(state),
)
})
})
})
@ -1798,8 +1970,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
self::const_directive(state).and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state)
.and_then(|state| self::const_directive(state))
super::hidden::skip(state).and_then(
|state| self::const_directive(state),
)
})
})
})
@ -1824,7 +1997,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
self::directive(state).and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state).and_then(|state| self::directive(state))
super::hidden::skip(state).and_then(
|state| self::directive(state),
)
})
})
})
@ -1846,7 +2021,9 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| super::hidden::skip(state))
.and_then(|state| self::name(state))
.and_then(|state| super::hidden::skip(state))
.and_then(|state| state.optional(|state| self::const_arguments(state)))
.and_then(|state| {
state.optional(|state| self::const_arguments(state))
})
})
})
}
@ -1883,14 +2060,16 @@ impl ::pest::Parser<Rule> for GraphQLParser {
.and_then(|state| {
state.sequence(|state| {
state.optional(|state| {
self::const_argument(state).and_then(|state| {
self::const_argument(state).and_then(
|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state)
.and_then(|state| self::const_argument(state))
})
})
})
},
)
})
})
})
@ -1921,7 +2100,10 @@ impl ::pest::Parser<Rule> for GraphQLParser {
self::argument(state).and_then(|state| {
state.repeat(|state| {
state.sequence(|state| {
super::hidden::skip(state).and_then(|state| self::argument(state))
super::hidden::skip(state)
.and_then(|state| {
self::argument(state)
})
})
})
})

View File

@ -2,11 +2,12 @@
//!
//! This module's structure mirrors `types`.
use std::collections::{hash_map, HashMap};
use pest::{
iterators::{Pair, Pairs},
Parser,
};
use pest_derive::Parser;
use utils::*;
use crate::{
@ -16,6 +17,7 @@ use crate::{
};
mod executable;
#[allow(clippy::redundant_static_lifetimes)]
mod generated;
mod service;
mod utils;

View File

@ -18,13 +18,11 @@ use super::GraphQLParser;
#[test]
fn generated_code_is_fresh() {
let input = format!(
r###"
let input = r###"
#[derive(Parser)]
#[grammar = r#"graphql.pest"#]
struct GraphQLParser;
"###,
)
"###
.parse::<proc_macro2::TokenStream>()
.unwrap();

View File

@ -1,6 +1,8 @@
use std::convert::Infallible;
use std::fmt::Display;
use std::num::{ParseFloatError, ParseIntError};
use std::{
convert::Infallible,
fmt::Display,
num::{ParseFloatError, ParseIntError},
};
use crate::ID;