From 08d66f0a4393a134d00815b616f3cf0c8845f30d Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sat, 30 Oct 2021 00:07:05 -0700 Subject: [PATCH] Run rustfmt on error.rs --- schala-lang/language/src/error.rs | 57 ++++++++++++------------------- 1 file changed, 21 insertions(+), 36 deletions(-) diff --git a/schala-lang/language/src/error.rs b/schala-lang/language/src/error.rs index 1bf28ec..c8c42d1 100644 --- a/schala-lang/language/src/error.rs +++ b/schala-lang/language/src/error.rs @@ -1,8 +1,10 @@ -use crate::parsing::ParseError; -use crate::schala::{SourceReference, Stage}; -use crate::tokenizing::{Location, Token, TokenKind}; -use crate::symbol_table::SymbolError; -use crate::type_inference::TypeError; +use crate::{ + parsing::ParseError, + schala::{SourceReference, Stage}, + symbol_table::SymbolError, + tokenizing::{Location, Token, TokenKind}, + type_inference::TypeError, +}; pub struct SchalaError { errors: Vec, @@ -23,42 +25,28 @@ impl SchalaError { pub(crate) fn from_type_error(err: TypeError) -> Self { Self { formatted_parse_error: None, - errors: vec![Error { - location: None, - text: Some(err.msg), - stage: Stage::Typechecking, - }], + errors: vec![Error { location: None, text: Some(err.msg), stage: Stage::Typechecking }], } } pub(crate) fn from_symbol_table(symbol_errs: Vec) -> Self { - //TODO this could be better - let errors = symbol_errs.into_iter().map(|_symbol_err| Error { - location: None, - text: Some("symbol table error".to_string()), - stage: Stage::Symbols - }).collect(); - Self { - errors, - formatted_parse_error: None - } + //TODO this could be better + let errors = symbol_errs + .into_iter() + .map(|_symbol_err| Error { + location: None, + text: Some("symbol table error".to_string()), + stage: Stage::Symbols, + }) + .collect(); + Self { errors, formatted_parse_error: None } } pub(crate) fn from_string(text: String, stage: Stage) -> Self { - Self { - formatted_parse_error: None, - errors: vec![Error { - location: None, - text: Some(text), - stage, - }], - } + Self { formatted_parse_error: None, errors: vec![Error { location: None, text: Some(text), stage }] } } - pub(crate) fn from_parse_error( - parse_error: ParseError, - source_reference: &SourceReference, - ) -> Self { + pub(crate) fn from_parse_error(parse_error: ParseError, source_reference: &SourceReference) -> Self { Self { formatted_parse_error: Some(format_parse_error(parse_error, source_reference)), errors: vec![], @@ -81,10 +69,7 @@ impl SchalaError { if token_errors.is_empty() { None } else { - Some(SchalaError { - errors: token_errors, - formatted_parse_error: None, - }) + Some(SchalaError { errors: token_errors, formatted_parse_error: None }) } } }