From 9daefab1e0edd3859d1d32d4be7b5d66fa981955 Mon Sep 17 00:00:00 2001 From: Teascade Date: Sun, 21 Jun 2020 01:40:00 +0300 Subject: [PATCH] Fix some warnings --- src/main.rs | 2 +- src/parser.rs | 14 ++------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/main.rs b/src/main.rs index d545e4b..2c0f5e9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,7 @@ mod file_io; mod parser; use file_io::open_file; -use parser::{ParsedReid, Parser}; +use parser::Parser; use std::path::Path; fn main() { diff --git a/src/parser.rs b/src/parser.rs index 9d5b46b..2b6c936 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -193,15 +193,6 @@ impl Parser { self.move_cursor(); } } - - fn empty() -> Parser { - Parser { - text: Vec::new(), - cursor: 0, - character_number: 0, - line_number: 0, - } - } } #[derive(Debug)] @@ -211,7 +202,6 @@ pub struct ParsedReid(Expression); pub enum Expression { BlockExpr(Position, Vec), StatementExpr(Position, Statement), - EmptyExpr, } impl Expression { @@ -312,13 +302,13 @@ pub struct Expect<'a> { } impl Expect<'_> { - pub fn get(mut self) -> Option { + pub fn get(self) -> Option { if self.text.is_some() { self.parser.move_cursor_multiple(self.len); } self.text } - pub fn get_or(mut self, error: CompilerError) -> Result { + pub fn get_or(self, error: CompilerError) -> Result { match self.get() { Some(text) => Ok(text), None => Err(error),