From 0fb2be4897c623ef2b678963a3c21f39f41ded90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Tue, 28 Apr 2020 02:39:58 +0200 Subject: [PATCH] Minor refactoring --- src/parse/formulas.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/parse/formulas.rs b/src/parse/formulas.rs index f7a57c4..ebe084c 100644 --- a/src/parse/formulas.rs +++ b/src/parse/formulas.rs @@ -137,10 +137,13 @@ impl<'i> FormulaStr<'i> None => Some(logical_connective), Some(top_level_logical_connective) => { - if (logical_connective == LogicalConnective::ImpliesLeftToRight - && top_level_logical_connective == LogicalConnective::ImpliesRightToLeft) - || (logical_connective == LogicalConnective::ImpliesRightToLeft - && top_level_logical_connective == LogicalConnective::ImpliesLeftToRight) + let implication_directions_are_mixed = + logical_connective == LogicalConnective::ImpliesLeftToRight + && top_level_logical_connective == LogicalConnective::ImpliesRightToLeft + || logical_connective == LogicalConnective::ImpliesRightToLeft + && top_level_logical_connective == LogicalConnective::ImpliesLeftToRight; + + if implication_directions_are_mixed { return Err(crate::parse::Error::new_mixed_implication_directions( crate::parse::error::Location::new(0, Some(0)),