mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-20 19:52:48 +00:00
Fix formatting
This commit is contained in:
parent
474a04615c
commit
774537fb01
@ -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""#);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user