diff --git a/src/parser/expression.rs b/src/parser/expression.rs index 21a2348..61decee 100644 --- a/src/parser/expression.rs +++ b/src/parser/expression.rs @@ -26,7 +26,7 @@ pub fn parse( .ok_or(Diagnostic::error( cursor, range.length, - format!("Cannot create an expression from {}", token.token_type), + "Expected a new expression", ))?; let (mut left_hand_side, new_cursor) = expression_handler(parser, cursor)?; diff --git a/src/parser/typing.rs b/src/parser/typing.rs index abc5620..f42219d 100644 --- a/src/parser/typing.rs +++ b/src/parser/typing.rs @@ -15,16 +15,11 @@ pub fn parse( ) -> Result<(Type, usize), Diagnostic> { let mut cursor = cursor; let (token, range) = expect_valid_token!(parser, cursor); - let type_handler = - parser - .lookup - .type_lookup - .get(&token.token_type) - .ok_or(Diagnostic::error( - cursor, - range.length, - format!("Cannot create a type from {}", token.token_type), - ))?; + let type_handler = parser + .lookup + .type_lookup + .get(&token.token_type) + .ok_or(Diagnostic::error(cursor, range.length, "Expected a type"))?; let (mut left_hand_side, new_cursor) = type_handler(parser, cursor)?;