From a565a42f46a2ad20dac598046943b09429f1a946 Mon Sep 17 00:00:00 2001 From: jDomantas Date: Mon, 17 Aug 2020 11:36:46 +0300 Subject: format --- crates/syntax/src/ast/edit.rs | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'crates/syntax/src/ast') diff --git a/crates/syntax/src/ast/edit.rs b/crates/syntax/src/ast/edit.rs index b295b5bc6..060b20966 100644 --- a/crates/syntax/src/ast/edit.rs +++ b/crates/syntax/src/ast/edit.rs @@ -119,27 +119,23 @@ impl ast::AssocItemList { /// Remove extra whitespace between last item and closing curly brace. fn fixup_trailing_whitespace(&self) -> Option { - let first_token_after_items = self - .assoc_items() - .last()? - .syntax() - .next_sibling_or_token()?; - let last_token_before_curly = self - .r_curly_token()? - .prev_sibling_or_token()?; + let first_token_after_items = + self.assoc_items().last()?.syntax().next_sibling_or_token()?; + let last_token_before_curly = self.r_curly_token()?.prev_sibling_or_token()?; if last_token_before_curly != first_token_after_items { // there is something more between last item and // right curly than just whitespace - bail out return None; } - let whitespace = last_token_before_curly - .clone() - .into_token() - .and_then(ast::Whitespace::cast)?; + let whitespace = + last_token_before_curly.clone().into_token().and_then(ast::Whitespace::cast)?; let text = whitespace.syntax().text(); let newline = text.rfind("\n")?; let keep = tokens::WsBuilder::new(&text[newline..]); - Some(self.replace_children(first_token_after_items..=last_token_before_curly, std::iter::once(keep.ws().into()))) + Some(self.replace_children( + first_token_after_items..=last_token_before_curly, + std::iter::once(keep.ws().into()), + )) } } -- cgit v1.2.3