From 5586aa7057523dffc791dbf6e95443f1c50d7989 Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Tue, 9 Oct 2018 19:58:15 -0600 Subject: [PATCH] remove needless self parameter from ambiguity_check --- src/prolog/heap_print.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/prolog/heap_print.rs b/src/prolog/heap_print.rs index a364a6c5..211f24e0 100644 --- a/src/prolog/heap_print.rs +++ b/src/prolog/heap_print.rs @@ -210,7 +210,7 @@ pub struct HCPrinter<'a, Formatter, Outputter> { macro_rules! push_space_if_amb { ($self:expr, $atom:expr, $op:expr, $action:block) => ( - match $self.ambiguity_check($atom, $op) { + match ambiguity_check($atom, $op) { Some(DirectedOp::Left(_)) => { $self.outputter.push_char(' '); $action; @@ -300,6 +300,20 @@ fn non_quoted_token>(mut iter: Iter) -> bool { } } +// return op itself if there is an ambiguity to indicate the direction the op +// lies, None otherwise. +fn ambiguity_check(atom: &str, op: &Option) -> Option +{ + match op { + &Some(DirectedOp::Left(ref lop)) if continues_with_append(lop.as_str(), atom) => + Some(DirectedOp::Left(lop.clone())), + &Some(DirectedOp::Right(ref rop)) if continues_with_append(atom, rop.as_str()) => + Some(DirectedOp::Right(rop.clone())), + _ => + None + } +} + impl<'a, Formatter: HCValueFormatter, Outputter: HCValueOutputter> HCPrinter<'a, Formatter, Outputter> { @@ -333,20 +347,6 @@ impl<'a, Formatter: HCValueFormatter, Outputter: HCValueOutputter> } } - // return op itself if there is an ambiguity to indicate the direction the op - // lies, None otherwise. - fn ambiguity_check(&mut self, atom: &str, op: &Option) -> Option - { - match op { - &Some(DirectedOp::Left(ref lop)) if continues_with_append(lop.as_str(), atom) => - Some(DirectedOp::Left(lop.clone())), - &Some(DirectedOp::Right(ref rop)) if continues_with_append(atom, rop.as_str()) => - Some(DirectedOp::Right(rop.clone())), - _ => - None - } - } - fn check_for_seen(&mut self, iter: &mut HCPreOrderIterator, op: &Option) -> Option { -- 2.54.0