diff options
author | Shotaro Yamada <[email protected]> | 2019-06-15 17:45:38 +0100 |
---|---|---|
committer | Shotaro Yamada <[email protected]> | 2019-06-15 17:45:38 +0100 |
commit | 774537fb01a8839d3cb933017067541bd0fd542b (patch) | |
tree | 3a82994adcb0cadcfc1da9ea651879f734b14144 /crates/ra_syntax/src/ast | |
parent | 474a04615cf6883de24c4b8ffeae15d8540ba9f5 (diff) |
Fix formatting
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/expr_extensions.rs | 10 |
1 files changed, 3 insertions, 7 deletions
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 { | |||
229 | 229 | ||
230 | impl ast::Literal { | 230 | impl ast::Literal { |
231 | pub fn token(&self) -> SyntaxToken { | 231 | pub fn token(&self) -> SyntaxToken { |
232 | let elem = self.syntax() | 232 | let elem = self |
233 | .syntax() | ||
233 | .children_with_tokens() | 234 | .children_with_tokens() |
234 | .find(|e| e.kind() != ATTR && !e.kind().is_trivia()); | 235 | .find(|e| e.kind() != ATTR && !e.kind().is_trivia()); |
235 | match elem { | 236 | match elem { |
@@ -274,12 +275,7 @@ impl ast::Literal { | |||
274 | #[test] | 275 | #[test] |
275 | fn test_literal_with_attr() { | 276 | fn test_literal_with_attr() { |
276 | let parse = ast::SourceFile::parse(r#"const _: &str = { #[attr] "Hello" };"#); | 277 | let parse = ast::SourceFile::parse(r#"const _: &str = { #[attr] "Hello" };"#); |
277 | let lit = parse | 278 | let lit = parse.tree.syntax().descendants().find_map(ast::Literal::cast).unwrap(); |
278 | .tree | ||
279 | .syntax() | ||
280 | .descendants() | ||
281 | .find_map(ast::Literal::cast) | ||
282 | .unwrap(); | ||
283 | assert_eq!(lit.token().text(), r#""Hello""#); | 279 | assert_eq!(lit.token().text(), r#""Hello""#); |
284 | } | 280 | } |
285 | 281 | ||