From f9e455ef883175d51d3c1f2b8832c187cf1eb8e8 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 29 Jan 2023 12:41:59 -0800 Subject: [PATCH] Recognize '->' token more specifically --- src/expr.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/expr.rs b/src/expr.rs index 4c98d25..bb0f6ba 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -10,8 +10,8 @@ pub fn parse(input: &mut TokenIter) -> Result { enum Lookbehind { JointColon, DoubleColon, + JointHyphen, Other, - JointOther, } let mut expr = TokenStream::new(); @@ -32,14 +32,12 @@ pub fn parse(input: &mut TokenIter) -> Result { angle_bracket_depth += 1; Lookbehind::Other } - '>' if angle_bracket_depth > 0 && lookbehind != Lookbehind::JointOther => { + '>' if angle_bracket_depth > 0 && lookbehind != Lookbehind::JointHyphen => { angle_bracket_depth -= 1; Lookbehind::Other } - _ => match spacing { - Spacing::Joint => Lookbehind::JointOther, - Spacing::Alone => Lookbehind::Other, - }, + '-' if spacing == Spacing::Joint => Lookbehind::JointHyphen, + _ => Lookbehind::Other, }; } Some(token) => expr.extend(iter::once(token)),