Fix some warnings

This commit is contained in:
Sofia 2020-06-21 01:40:00 +03:00
parent b3e13dfb5a
commit 9daefab1e0
2 changed files with 3 additions and 13 deletions

View File

@ -3,7 +3,7 @@ mod file_io;
mod parser; mod parser;
use file_io::open_file; use file_io::open_file;
use parser::{ParsedReid, Parser}; use parser::Parser;
use std::path::Path; use std::path::Path;
fn main() { fn main() {

View File

@ -193,15 +193,6 @@ impl Parser {
self.move_cursor(); self.move_cursor();
} }
} }
fn empty() -> Parser {
Parser {
text: Vec::new(),
cursor: 0,
character_number: 0,
line_number: 0,
}
}
} }
#[derive(Debug)] #[derive(Debug)]
@ -211,7 +202,6 @@ pub struct ParsedReid(Expression);
pub enum Expression { pub enum Expression {
BlockExpr(Position, Vec<Expression>), BlockExpr(Position, Vec<Expression>),
StatementExpr(Position, Statement), StatementExpr(Position, Statement),
EmptyExpr,
} }
impl Expression { impl Expression {
@ -312,13 +302,13 @@ pub struct Expect<'a> {
} }
impl Expect<'_> { impl Expect<'_> {
pub fn get(mut self) -> Option<String> { pub fn get(self) -> Option<String> {
if self.text.is_some() { if self.text.is_some() {
self.parser.move_cursor_multiple(self.len); self.parser.move_cursor_multiple(self.len);
} }
self.text self.text
} }
pub fn get_or(mut self, error: CompilerError) -> Result<String, CompilerError> { pub fn get_or(self, error: CompilerError) -> Result<String, CompilerError> {
match self.get() { match self.get() {
Some(text) => Ok(text), Some(text) => Ok(text),
None => Err(error), None => Err(error),