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;
use file_io::open_file;
use parser::{ParsedReid, Parser};
use parser::Parser;
use std::path::Path;
fn main() {

View File

@ -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<Expression>),
StatementExpr(Position, Statement),
EmptyExpr,
}
impl Expression {
@ -312,13 +302,13 @@ pub struct Expect<'a> {
}
impl Expect<'_> {
pub fn get(mut self) -> Option<String> {
pub fn get(self) -> Option<String> {
if self.text.is_some() {
self.parser.move_cursor_multiple(self.len);
}
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() {
Some(text) => Ok(text),
None => Err(error),