all: clippy

This commit is contained in:
Ryan Chandler 2022-07-26 17:56:10 +01:00
parent 013e2403ad
commit f5c3143468
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA
3 changed files with 13 additions and 13 deletions

View File

@ -2,7 +2,7 @@ use std::fmt::Display;
pub type Span = (usize, usize);
#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, Eq, PartialEq, Clone)]
pub enum OpenTagKind {
Full,
}

View File

@ -4,7 +4,7 @@ use trunk_lexer::TokenKind;
pub type Block = Vec<Statement>;
pub type Program = Block;
#[derive(Debug, PartialEq, Clone, Serialize)]
#[derive(Debug, Eq, PartialEq, Clone, Serialize)]
pub enum Type {
Plain(String),
Nullable(String),
@ -12,7 +12,7 @@ pub enum Type {
Intersection(Vec<String>),
}
#[derive(Debug, PartialEq, Clone, Serialize)]
#[derive(Debug, Eq, PartialEq, Clone, Serialize)]
pub struct Identifier {
name: String,
}
@ -61,7 +61,7 @@ impl From<&str> for Param {
}
}
#[derive(Debug, Clone, PartialEq, Serialize)]
#[derive(Debug, Clone, Eq, PartialEq, Serialize)]
pub enum PropertyFlag {
Public,
Protected,
@ -81,7 +81,7 @@ impl From<TokenKind> for PropertyFlag {
}
}
#[derive(Debug, Clone, PartialEq, Serialize)]
#[derive(Debug, Clone, Eq, PartialEq, Serialize)]
pub enum MethodFlag {
Final,
Abstract,
@ -105,7 +105,7 @@ impl From<TokenKind> for MethodFlag {
}
}
#[derive(Debug, Clone, PartialEq, Serialize)]
#[derive(Debug, Clone, Eq, PartialEq, Serialize)]
pub enum ClassFlag {
Final,
Abstract,
@ -203,7 +203,7 @@ pub enum Statement {
Noop,
}
#[derive(Debug, Clone, PartialEq, Serialize)]
#[derive(Debug, Clone, Eq, PartialEq, Serialize)]
pub enum ConstFlag {
Final,
Public,
@ -223,7 +223,7 @@ impl From<TokenKind> for ConstFlag {
}
}
#[derive(Debug, Clone, PartialEq, Serialize)]
#[derive(Debug, Clone, Eq, PartialEq, Serialize)]
pub struct Use {
pub name: Identifier,
pub alias: Option<Identifier>,
@ -252,7 +252,7 @@ pub struct ArrayItem {
pub value: Expression,
}
#[derive(Debug, PartialEq, Clone, Serialize)]
#[derive(Debug, Eq, PartialEq, Clone, Serialize)]
pub enum InfixOp {
Add,
Sub,

View File

@ -1,6 +1,6 @@
use std::{vec::IntoIter, fmt::{Display}};
use trunk_lexer::{Token, TokenKind, Span};
use crate::{Program, Statement, Block, Expression, ast::{ArrayItem, Use, MethodFlag, ClassFlag, ElseIf}, Identifier, Type, Param};
use crate::{Program, Statement, Block, Expression, ast::{ArrayItem, Use, MethodFlag, ClassFlag, ElseIf}, Identifier, Type};
type ParseResult<T> = Result<T, ParseError>;
@ -338,7 +338,7 @@ impl Parser {
expect!(self, TokenKind::LeftBrace, "expected {");
let mut r#else = self.block(&TokenKind::RightBrace)?;
let r#else = self.block(&TokenKind::RightBrace)?;
expect!(self, TokenKind::RightBrace, "expected }");
@ -415,7 +415,7 @@ impl Parser {
expect!(self, TokenKind::LeftBrace, "expected {");
let mut body = self.block(&TokenKind::RightBrace)?;
let body = self.block(&TokenKind::RightBrace)?;
expect!(self, TokenKind::RightBrace, "expected }");
@ -626,7 +626,7 @@ impl Parser {
}
},
// TODO: Support use statements.
_ => return Err(ParseError::UnexpectedToken(format!("{}", self.current.kind), self.current.span))
_ => Err(ParseError::UnexpectedToken(format!("{}", self.current.kind), self.current.span))
}
}