diff --git a/src/error.rs b/src/error.rs index 6feb602..f64a9e4 100644 --- a/src/error.rs +++ b/src/error.rs @@ -29,7 +29,7 @@ impl<'a> From<&'a OwnedLocation> for Location<'a> { Location { line: l.line, col: l.col, - file: l.file.as_ref().map(|v| v.as_str()), + file: l.file.as_deref(), } } } diff --git a/src/lexer/error.rs b/src/lexer/error.rs index 9ad8a57..9130a80 100644 --- a/src/lexer/error.rs +++ b/src/lexer/error.rs @@ -1,4 +1,3 @@ -use crate::error::{ErrorWithLocation, Location, OwnedLocation}; use core::fmt; use std::error::Error; diff --git a/src/lib.rs b/src/lib.rs index e1e9225..0209337 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,19 +39,19 @@ mod run { Error::ASTParsing(_) => "ast generation", Error::Runtime(_) => "runtime", }; - write!(f, "Errors occured during {error_kind}\n")?; + writeln!(f, "Errors occured during {error_kind}")?; match *self { Error::Lexing(ref errors) => { for error in errors { - write!(f, "{error} \n")?; + writeln!(f, "{error} ")?; } } Error::ASTParsing(ref 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(()) diff --git a/tests/integration_test.rs b/tests/integration_test.rs index 7414e26..357aacb 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -1,5 +1,5 @@ -use crftng_intrprtrs::run; use crftng_intrprtrs::interpreter::types; +use crftng_intrprtrs::run; #[test] fn test_one_equality() { @@ -12,6 +12,8 @@ fn test_one_equality() { } 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)) + ) }