From a05cb65434de31a5837ddad25669c43feae3569a Mon Sep 17 00:00:00 2001 From: bakk Date: Tue, 1 Jun 2021 00:22:42 +0200 Subject: [PATCH] Removed redundant if --- kalk/src/parser.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/kalk/src/parser.rs b/kalk/src/parser.rs index f1f351f..0ca3811 100644 --- a/kalk/src/parser.rs +++ b/kalk/src/parser.rs @@ -582,14 +582,12 @@ fn parse_identifier(context: &mut Context) -> Result { && (match_token(context, TokenKind::Literal) || match_token(context, TokenKind::Identifier)) { // If there is a function with this name, parse it as a function, with the next token as the argument. - if exists_as_fn { - let parameter = if identifier.full_name == "√" { - parse_exponent(context)? - } else { - parse_factor(context)? - }; - return Ok(Expr::FnCall(identifier, vec![parameter])); - } + let parameter = if identifier.full_name == "√" { + parse_exponent(context)? + } else { + parse_factor(context)? + }; + return Ok(Expr::FnCall(identifier, vec![parameter])); } let parse_as_var_instead = match_token(context, TokenKind::OpenParenthesis)