Remove unneeded precedence implementation

This commit is contained in:
Patrick Lühne 2020-04-06 13:37:37 +02:00
parent 881419b8ee
commit 121c858bff
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF

View File

@ -1,34 +1,5 @@
use super::*; use super::*;
impl super::Precedence for crate::Formula
{
fn precedence_level(&self) -> i32
{
match &self
{
Self::Predicate(_)
| Self::Boolean(_)
| Self::Compare(_)
=> 0,
/*Self::And(formulas)
| Self::Or(formulas) if formulas.len() == 1
=> 0,*/
Self::Not(_)
| Self::Exists(_)
| Self::ForAll(_)
=> 1,
Self::And(_)
=> 2,
Self::Or(_)
=> 3,
Self::Implies(_)
=> 4,
Self::IfAndOnlyIf(_)
=> 5,
}
}
}
fn requires_parentheses<'formula>(formula: &'formula crate::Formula, fn requires_parentheses<'formula>(formula: &'formula crate::Formula,
parent_formula: &'formula crate::Formula) parent_formula: &'formula crate::Formula)
-> bool -> bool
@ -148,7 +119,6 @@ impl<'formula> std::fmt::Debug for FormulaDisplay<'formula>
{ {
fn fmt(&self, format: &mut std::fmt::Formatter) -> std::fmt::Result fn fmt(&self, format: &mut std::fmt::Formatter) -> std::fmt::Result
{ {
let precedence_level = self.formula.precedence_level();
let requires_parentheses = match self.parent_formula let requires_parentheses = match self.parent_formula
{ {
Some(ref parent_formula) => requires_parentheses(self.formula, parent_formula), Some(ref parent_formula) => requires_parentheses(self.formula, parent_formula),