From a52a3717a22ad90e246695c68ea478b57d5ba4cc Mon Sep 17 00:00:00 2001 From: Reese Williams Date: Thu, 22 Feb 2024 16:14:42 +0000 Subject: [PATCH] fmt --- librubyfmt/src/render_targets.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/librubyfmt/src/render_targets.rs b/librubyfmt/src/render_targets.rs index d02125a1..8041782c 100644 --- a/librubyfmt/src/render_targets.rs +++ b/librubyfmt/src/render_targets.rs @@ -304,14 +304,27 @@ impl AbstractTokenTarget for BreakableCallChainEntry { { tokens.pop(); } - let call_count = tokens.iter().filter(|t| matches!(t, AbstractLineToken::ConcreteLineToken(ConcreteLineToken::Dot | ConcreteLineToken::LonelyOperator))).count(); + let call_count = tokens + .iter() + .filter(|t| { + matches!( + t, + AbstractLineToken::ConcreteLineToken( + ConcreteLineToken::Dot | ConcreteLineToken::LonelyOperator + ) + ) + }) + .count(); // If the last breakable is multiline (and not a block/block params), ignore it. The user likely // intentionally chose a line break strategy, so try our best to respect it. // // However, if there's only one item in the chain, try our best to leave that in place. // `foo\n.bar` is always a little awkward. if let Some(AbstractLineToken::BreakableEntry(be)) = tokens.last() { - if (call_count == 1 || be.is_multiline()) && be.delims != BreakableDelims::for_brace_block() && be.delims != BreakableDelims::for_block_params() { + if (call_count == 1 || be.is_multiline()) + && be.delims != BreakableDelims::for_brace_block() + && be.delims != BreakableDelims::for_block_params() + { tokens.pop(); } }