mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-31 17:12:53 +00:00
get matches from code.descendants
This commit is contained in:
parent
94603d9848
commit
b1ee6d17a4
@ -223,15 +223,17 @@ fn find(pattern: &SsrPattern, code: &SyntaxNode) -> SsrMatches {
|
||||
}
|
||||
let kind = pattern.pattern.kind();
|
||||
let matches = code
|
||||
.descendants_with_tokens()
|
||||
.descendants()
|
||||
.filter(|n| n.kind() == kind)
|
||||
.filter_map(|code| {
|
||||
let match_ = Match {
|
||||
place: code.as_node().unwrap().clone(),
|
||||
binding: HashMap::new(),
|
||||
ignored_comments: vec![],
|
||||
};
|
||||
check(&SyntaxElement::from(pattern.pattern.clone()), &code, &pattern.vars, match_)
|
||||
let match_ =
|
||||
Match { place: code.clone(), binding: HashMap::new(), ignored_comments: vec![] };
|
||||
check(
|
||||
&SyntaxElement::from(pattern.pattern.clone()),
|
||||
&SyntaxElement::from(code),
|
||||
&pattern.vars,
|
||||
match_,
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
SsrMatches { matches }
|
||||
|
Loading…
Reference in New Issue
Block a user