From b1ee6d17a4af6a2fcbaeb0b98965cd610c7b1b72 Mon Sep 17 00:00:00 2001 From: adamrk Date: Tue, 25 Feb 2020 23:53:29 +0100 Subject: get matches from code.descendants --- crates/ra_ide/src/ssr.rs | 16 +++++++++------- 1 file 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 { } 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 } -- cgit v1.2.3