From a9fdff06639f1c995585a2c08e539dde0e2d9627 Mon Sep 17 00:00:00 2001 From: Erin Date: Wed, 14 Sep 2022 21:46:24 +0200 Subject: [PATCH] fmt + clippy --- ablescript/src/ast.rs | 4 ++-- ablescript/src/lexer.rs | 4 ++-- ablescript/src/value/functio.rs | 8 +++++--- ablescript/src/value/mod.rs | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ablescript/src/ast.rs b/ablescript/src/ast.rs index 9ab00fe..5b564f1 100644 --- a/ablescript/src/ast.rs +++ b/ablescript/src/ast.rs @@ -168,7 +168,7 @@ pub enum Expr { Variable(String), } -#[derive(Debug, PartialEq, Clone, Hash)] +#[derive(Debug, PartialEq, Eq, Clone, Hash)] pub enum Literal { Char(char), Int(isize), @@ -185,7 +185,7 @@ impl From for Value { } } -#[derive(Debug, PartialEq, Clone, Hash)] +#[derive(Debug, PartialEq, Eq, Clone, Hash)] pub enum BinOpKind { Add, Subtract, diff --git a/ablescript/src/lexer.rs b/ablescript/src/lexer.rs index ca5e67c..a450c76 100644 --- a/ablescript/src/lexer.rs +++ b/ablescript/src/lexer.rs @@ -1,6 +1,6 @@ use logos::{Lexer, Logos}; -#[derive(Logos, Debug, PartialEq, Clone)] +#[derive(Logos, Debug, PartialEq, Eq, Clone)] pub enum Token { // Symbols #[token("(")] @@ -104,7 +104,7 @@ pub enum Token { /// Run at the end of the program #[token("finally")] Finally, - + /// Crash with random error (see discussion #17) #[token("rlyeh")] Rlyeh, diff --git a/ablescript/src/value/functio.rs b/ablescript/src/value/functio.rs index db616d4..950c559 100644 --- a/ablescript/src/value/functio.rs +++ b/ablescript/src/value/functio.rs @@ -2,6 +2,8 @@ use super::ValueRef; use crate::ast::Block; use std::{hash::Hash, rc::Rc}; +type BuiltinRc = Rc Result<(), crate::error::ErrorKind>>; + /// AbleScript Function #[derive(Debug, PartialEq, Clone, Hash)] pub enum Functio { @@ -49,13 +51,13 @@ impl Functio { /// Built-in Rust functio #[derive(Clone)] pub struct BuiltinFunctio { - pub(super) function: Rc Result<(), crate::error::ErrorKind>>, + pub(super) function: BuiltinRc, pub(super) arity: usize, } impl BuiltinFunctio { /// Wrap a Rust function into AbleScript's built-in functio - /// + /// /// Arity used for functio chaining, recommend value for variadic /// functions is the accepted minimum. pub fn new(f: F, arity: usize) -> Self @@ -100,7 +102,7 @@ impl Hash for BuiltinFunctio { } /// A method of distributting parameters across functio chain -#[derive(Debug, PartialEq, Copy, Clone, Hash)] +#[derive(Debug, PartialEq, Eq, Copy, Clone, Hash)] pub enum FunctioChainKind { /// All parameters are equally distributed Equal, diff --git a/ablescript/src/value/mod.rs b/ablescript/src/value/mod.rs index a9b1576..2fc8998 100644 --- a/ablescript/src/value/mod.rs +++ b/ablescript/src/value/mod.rs @@ -58,7 +58,7 @@ impl Value { } /// Three-state logic value -#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd)] pub enum Abool { Never = -1, Sometimes = 0, @@ -163,7 +163,7 @@ impl Display for Value { } /// Runtime borrow-checked, counted reference to a [Value] -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct ValueRef(Rc>); impl ValueRef {