From: Mark Thom Date: Wed, 10 Oct 2018 01:58:15 +0000 (-0600) Subject: remove needless self parameter from ambiguity_check X-Git-Tag: v0.8.110~335 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=5586aa7057523dffc791dbf6e95443f1c50d7989;p=scryer-prolog.git remove needless self parameter from ambiguity_check --- 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 {