aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradamrk <[email protected]>2020-02-25 22:53:29 +0000
committeradamrk <[email protected]>2020-02-25 22:53:29 +0000
commitb1ee6d17a4af6a2fcbaeb0b98965cd610c7b1b72 (patch)
treed2ad0892ee59714219f25564544e8f79c2f903e0
parent94603d984808f140931fe517d500bc61d871ea24 (diff)
get matches from code.descendants
-rw-r--r--crates/ra_ide/src/ssr.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/crates/ra_ide/src/ssr.rs b/crates/ra_ide/src/ssr.rs
index 74fb6bab6..c011a2e74 100644
--- a/crates/ra_ide/src/ssr.rs
+++ b/crates/ra_ide/src/ssr.rs
@@ -223,15 +223,17 @@ fn find(pattern: &SsrPattern, code: &SyntaxNode) -> SsrMatches {
223 } 223 }
224 let kind = pattern.pattern.kind(); 224 let kind = pattern.pattern.kind();
225 let matches = code 225 let matches = code
226 .descendants_with_tokens() 226 .descendants()
227 .filter(|n| n.kind() == kind) 227 .filter(|n| n.kind() == kind)
228 .filter_map(|code| { 228 .filter_map(|code| {
229 let match_ = Match { 229 let match_ =
230 place: code.as_node().unwrap().clone(), 230 Match { place: code.clone(), binding: HashMap::new(), ignored_comments: vec![] };
231 binding: HashMap::new(), 231 check(
232 ignored_comments: vec![], 232 &SyntaxElement::from(pattern.pattern.clone()),
233 }; 233 &SyntaxElement::from(code),
234 check(&SyntaxElement::from(pattern.pattern.clone()), &code, &pattern.vars, match_) 234 &pattern.vars,
235 match_,
236 )
235 }) 237 })
236 .collect(); 238 .collect();
237 SsrMatches { matches } 239 SsrMatches { matches }