From beca01c826ee51c9ee6d5eadd7e5ef10f7fb9f58 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 18 Mar 2022 23:36:18 +0100 Subject: Methods --- src/parse/parser.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/parse/parser.rs') diff --git a/src/parse/parser.rs b/src/parse/parser.rs index 33cf489c..63ba4918 100644 --- a/src/parse/parser.rs +++ b/src/parse/parser.rs @@ -352,7 +352,16 @@ impl<'s> Parser<'s> { match self.groups.last().map(|group| group.kind) { Some(Group::Strong | Group::Emph) => n >= 2, - Some(Group::Expr | Group::Imports) => n >= 1, + Some(Group::Imports) => n >= 1, + Some(Group::Expr) if n >= 1 => { + // Allow else and method call to continue on next line. + self.groups.iter().nth_back(1).map(|group| group.kind) + != Some(Group::Brace) + || !matches!( + self.tokens.clone().next(), + Some(NodeKind::Else | NodeKind::Dot) + ) + } _ => false, } } -- cgit v1.2.3