diff --git a/src/expr.rs b/src/expr.rs index e802e20..bb0f6ba 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -10,6 +10,7 @@ pub fn parse(input: &mut TokenIter) -> Result { enum Lookbehind { JointColon, DoubleColon, + JointHyphen, Other, } @@ -31,10 +32,11 @@ pub fn parse(input: &mut TokenIter) -> Result { angle_bracket_depth += 1; Lookbehind::Other } - '>' if angle_bracket_depth > 0 => { + '>' if angle_bracket_depth > 0 && lookbehind != Lookbehind::JointHyphen => { angle_bracket_depth -= 1; Lookbehind::Other } + '-' if spacing == Spacing::Joint => Lookbehind::JointHyphen, _ => Lookbehind::Other, }; } diff --git a/tests/test_writedoc.rs b/tests/test_writedoc.rs index 8d19468..b87f2f4 100644 --- a/tests/test_writedoc.rs +++ b/tests/test_writedoc.rs @@ -42,13 +42,13 @@ fn test_angle_bracket_parsing() { const ZERO: usize = 0; struct Pair(A, B); - impl Pair<(), ()> { + impl Pair { const ONE: usize = 1; } let mut s = String::new(); let _ = writedoc! { - if ZERO < Pair::<(), ()>::ONE { &mut s } else { &mut s }, + if ZERO < Pair:: (), ()>::ONE { &mut s } else { &mut s }, "writedoc", };