From 774537fb01a8839d3cb933017067541bd0fd542b Mon Sep 17 00:00:00 2001 From: Shotaro Yamada Date: Sun, 16 Jun 2019 01:45:38 +0900 Subject: Fix formatting --- crates/ra_syntax/src/ast/expr_extensions.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'crates/ra_syntax') diff --git a/crates/ra_syntax/src/ast/expr_extensions.rs b/crates/ra_syntax/src/ast/expr_extensions.rs index 66fe77a19..d88671d45 100644 --- a/crates/ra_syntax/src/ast/expr_extensions.rs +++ b/crates/ra_syntax/src/ast/expr_extensions.rs @@ -229,7 +229,8 @@ pub enum LiteralKind { impl ast::Literal { pub fn token(&self) -> SyntaxToken { - let elem = self.syntax() + let elem = self + .syntax() .children_with_tokens() .find(|e| e.kind() != ATTR && !e.kind().is_trivia()); match elem { @@ -274,12 +275,7 @@ impl ast::Literal { #[test] fn test_literal_with_attr() { let parse = ast::SourceFile::parse(r#"const _: &str = { #[attr] "Hello" };"#); - let lit = parse - .tree - .syntax() - .descendants() - .find_map(ast::Literal::cast) - .unwrap(); + let lit = parse.tree.syntax().descendants().find_map(ast::Literal::cast).unwrap(); assert_eq!(lit.token().text(), r#""Hello""#); } -- cgit v1.2.3