mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
reformat the world
This commit is contained in:
parent
5cb1d41a30
commit
12e3b4c70b
129 changed files with 727 additions and 2509 deletions
|
@ -133,11 +133,7 @@ fn match_lhs(pattern: &crate::Subtree, input: &mut TtCursor) -> Option<Bindings>
|
|||
}
|
||||
_ => return None,
|
||||
},
|
||||
crate::TokenTree::Repeat(crate::Repeat {
|
||||
subtree,
|
||||
kind: _,
|
||||
separator,
|
||||
}) => {
|
||||
crate::TokenTree::Repeat(crate::Repeat { subtree, kind: _, separator }) => {
|
||||
while let Some(nested) = match_lhs(subtree, input) {
|
||||
res.push_nested(nested)?;
|
||||
if let Some(separator) = *separator {
|
||||
|
@ -166,10 +162,7 @@ fn expand_subtree(
|
|||
.map(|it| expand_tt(it, bindings, nesting))
|
||||
.collect::<Option<Vec<_>>>()?;
|
||||
|
||||
Some(tt::Subtree {
|
||||
token_trees,
|
||||
delimiter: template.delimiter,
|
||||
})
|
||||
Some(tt::Subtree { token_trees, delimiter: template.delimiter })
|
||||
}
|
||||
|
||||
fn expand_tt(
|
||||
|
@ -188,23 +181,15 @@ fn expand_tt(
|
|||
token_trees.push(t.into())
|
||||
}
|
||||
nesting.pop().unwrap();
|
||||
tt::Subtree {
|
||||
token_trees,
|
||||
delimiter: tt::Delimiter::None,
|
||||
}
|
||||
.into()
|
||||
tt::Subtree { token_trees, delimiter: tt::Delimiter::None }.into()
|
||||
}
|
||||
crate::TokenTree::Leaf(leaf) => match leaf {
|
||||
crate::Leaf::Ident(ident) => tt::Leaf::from(tt::Ident {
|
||||
text: ident.text.clone(),
|
||||
})
|
||||
.into(),
|
||||
crate::Leaf::Ident(ident) => {
|
||||
tt::Leaf::from(tt::Ident { text: ident.text.clone() }).into()
|
||||
}
|
||||
crate::Leaf::Punct(punct) => tt::Leaf::from(punct.clone()).into(),
|
||||
crate::Leaf::Var(v) => bindings.get(&v.text, nesting)?.clone(),
|
||||
crate::Leaf::Literal(l) => tt::Leaf::from(tt::Literal {
|
||||
text: l.text.clone(),
|
||||
})
|
||||
.into(),
|
||||
crate::Leaf::Literal(l) => tt::Leaf::from(tt::Literal { text: l.text.clone() }).into(),
|
||||
},
|
||||
};
|
||||
Some(res)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue