Run all the linters

This commit is contained in:
bad 2022-04-03 22:07:19 +02:00
parent 74770a7a31
commit ef765220a2
4 changed files with 10 additions and 9 deletions

View file

@ -29,7 +29,7 @@ impl<'a> From<&'a OwnedLocation> for Location<'a> {
Location { Location {
line: l.line, line: l.line,
col: l.col, col: l.col,
file: l.file.as_ref().map(|v| v.as_str()), file: l.file.as_deref(),
} }
} }
} }

View file

@ -1,4 +1,3 @@
use crate::error::{ErrorWithLocation, Location, OwnedLocation};
use core::fmt; use core::fmt;
use std::error::Error; use std::error::Error;

View file

@ -39,19 +39,19 @@ mod run {
Error::ASTParsing(_) => "ast generation", Error::ASTParsing(_) => "ast generation",
Error::Runtime(_) => "runtime", Error::Runtime(_) => "runtime",
}; };
write!(f, "Errors occured during {error_kind}\n")?; writeln!(f, "Errors occured during {error_kind}")?;
match *self { match *self {
Error::Lexing(ref errors) => { Error::Lexing(ref errors) => {
for error in errors { for error in errors {
write!(f, "{error} \n")?; writeln!(f, "{error} ")?;
} }
} }
Error::ASTParsing(ref errors) => { Error::ASTParsing(ref errors) => {
for error in errors { for error in errors {
write!(f, "{error} \n")?; writeln!(f, "{error} ")?;
} }
} }
Error::Runtime(ref error) => write!(f, "{error} \n")?, Error::Runtime(ref error) => writeln!(f, "{error} ")?,
}; };
Ok(()) Ok(())

View file

@ -1,5 +1,5 @@
use crftng_intrprtrs::run;
use crftng_intrprtrs::interpreter::types; use crftng_intrprtrs::interpreter::types;
use crftng_intrprtrs::run;
#[test] #[test]
fn test_one_equality() { fn test_one_equality() {
@ -12,6 +12,8 @@ fn test_one_equality() {
} }
fn run_check_result_eq_bool(code: &str, value: bool) { fn run_check_result_eq_bool(code: &str, value: bool) {
assert_eq!(run(code).unwrap(), types::Value::Primitive(types::Primitive::Bool(value))) assert_eq!(
run(code).unwrap(),
types::Value::Primitive(types::Primitive::Bool(value))
)
} }