mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
Fix formatting
This commit is contained in:
parent
474a04615c
commit
774537fb01
1 changed files with 3 additions and 7 deletions
|
@ -229,7 +229,8 @@ pub enum LiteralKind {
|
||||||
|
|
||||||
impl ast::Literal {
|
impl ast::Literal {
|
||||||
pub fn token(&self) -> SyntaxToken {
|
pub fn token(&self) -> SyntaxToken {
|
||||||
let elem = self.syntax()
|
let elem = self
|
||||||
|
.syntax()
|
||||||
.children_with_tokens()
|
.children_with_tokens()
|
||||||
.find(|e| e.kind() != ATTR && !e.kind().is_trivia());
|
.find(|e| e.kind() != ATTR && !e.kind().is_trivia());
|
||||||
match elem {
|
match elem {
|
||||||
|
@ -274,12 +275,7 @@ impl ast::Literal {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_literal_with_attr() {
|
fn test_literal_with_attr() {
|
||||||
let parse = ast::SourceFile::parse(r#"const _: &str = { #[attr] "Hello" };"#);
|
let parse = ast::SourceFile::parse(r#"const _: &str = { #[attr] "Hello" };"#);
|
||||||
let lit = parse
|
let lit = parse.tree.syntax().descendants().find_map(ast::Literal::cast).unwrap();
|
||||||
.tree
|
|
||||||
.syntax()
|
|
||||||
.descendants()
|
|
||||||
.find_map(ast::Literal::cast)
|
|
||||||
.unwrap();
|
|
||||||
assert_eq!(lit.token().text(), r#""Hello""#);
|
assert_eq!(lit.token().text(), r#""Hello""#);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue