Skip to content

Commit

Permalink
appease clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
obmarg committed Jan 13, 2024
1 parent 05b784b commit 213707f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
20 changes: 9 additions & 11 deletions cynic-parser/src/ast/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,22 @@ impl super::Ast {
impl Ast {
pub fn definitions(&self) -> impl Iterator<Item = Definition<'_>> + '_ {
self.definitions.iter().map(|definition| match definition {
ast::AstDefinition::Schema(id) => Definition::SchemaDefinition(self.read(*id)),
ast::AstDefinition::Schema(id) => Definition::Schema(self.read(*id)),
ast::AstDefinition::Scalar(id) => {
Definition::TypeDefinition(TypeDefinition::Scalar(self.read(*id)))
Definition::Type(TypeDefinition::Scalar(self.read(*id)))
}
ast::AstDefinition::Object(id) => {
Definition::TypeDefinition(TypeDefinition::Object(self.read(*id)))
Definition::Type(TypeDefinition::Object(self.read(*id)))
}
ast::AstDefinition::Interface(id) => {
Definition::TypeDefinition(TypeDefinition::Interface(self.read(*id)))
Definition::Type(TypeDefinition::Interface(self.read(*id)))
}
ast::AstDefinition::Union(id) => {
Definition::TypeDefinition(TypeDefinition::Union(self.read(*id)))
}
ast::AstDefinition::Enum(id) => {
Definition::TypeDefinition(TypeDefinition::Enum(self.read(*id)))
Definition::Type(TypeDefinition::Union(self.read(*id)))
}
ast::AstDefinition::Enum(id) => Definition::Type(TypeDefinition::Enum(self.read(*id))),
ast::AstDefinition::InputObject(id) => {
Definition::TypeDefinition(TypeDefinition::InputObject(self.read(*id)))
Definition::Type(TypeDefinition::InputObject(self.read(*id)))
}
ast::AstDefinition::SchemaExtension(id) => Definition::SchemaExtension(self.read(*id)),
ast::AstDefinition::ScalarExtension(id) => {
Expand All @@ -71,9 +69,9 @@ impl Ast {
}

pub enum Definition<'a> {
SchemaDefinition(AstReader<'a, SchemaDefinitionId>),
Schema(AstReader<'a, SchemaDefinitionId>),
SchemaExtension(AstReader<'a, SchemaDefinitionId>),
TypeDefinition(TypeDefinition<'a>),
Type(TypeDefinition<'a>),
TypeExtension(TypeDefinition<'a>),
Directive(AstReader<'a, DirectiveDefinitionId>),
}
Expand Down
14 changes: 7 additions & 7 deletions cynic-parser/src/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ impl crate::Ast {
let builder = allocator
.intersperse(
self.definitions().map(|definition| match definition {
Definition::SchemaDefinition(reader) => NodeDisplay(reader).pretty(&allocator),
Definition::Schema(reader) => NodeDisplay(reader).pretty(&allocator),
Definition::SchemaExtension(reader) => allocator
.text("extend")
.append(allocator.space())
.append(NodeDisplay(reader).pretty(&allocator)),
Definition::TypeDefinition(TypeDefinition::Scalar(reader)) => {
Definition::Type(TypeDefinition::Scalar(reader)) => {
NodeDisplay(reader).pretty(&allocator)
}
Definition::TypeDefinition(TypeDefinition::Object(reader)) => {
Definition::Type(TypeDefinition::Object(reader)) => {
NodeDisplay(reader).pretty(&allocator)
}
Definition::TypeDefinition(TypeDefinition::Interface(reader)) => {
Definition::Type(TypeDefinition::Interface(reader)) => {
NodeDisplay(reader).pretty(&allocator)
}
Definition::TypeDefinition(TypeDefinition::Union(reader)) => {
Definition::Type(TypeDefinition::Union(reader)) => {
NodeDisplay(reader).pretty(&allocator)
}
Definition::TypeDefinition(TypeDefinition::Enum(reader)) => {
Definition::Type(TypeDefinition::Enum(reader)) => {
NodeDisplay(reader).pretty(&allocator)
}
Definition::TypeDefinition(TypeDefinition::InputObject(reader)) => {
Definition::Type(TypeDefinition::InputObject(reader)) => {
NodeDisplay(reader).pretty(&allocator)
}
Definition::TypeExtension(TypeDefinition::Scalar(reader)) => allocator
Expand Down

0 comments on commit 213707f

Please sign in to comment.