diff options
Diffstat (limited to 'crates/ra_ssr/src/lib.rs')
-rw-r--r-- | crates/ra_ssr/src/lib.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/crates/ra_ssr/src/lib.rs b/crates/ra_ssr/src/lib.rs index fc716ae82..da26ee669 100644 --- a/crates/ra_ssr/src/lib.rs +++ b/crates/ra_ssr/src/lib.rs | |||
@@ -91,14 +91,16 @@ impl<'db> MatchFinder<'db> { | |||
91 | if let Ok(mut m) = matching::get_match(false, rule, &code, restrict_range, &self.sema) { | 91 | if let Ok(mut m) = matching::get_match(false, rule, &code, restrict_range, &self.sema) { |
92 | // Continue searching in each of our placeholders. | 92 | // Continue searching in each of our placeholders. |
93 | for placeholder_value in m.placeholder_values.values_mut() { | 93 | for placeholder_value in m.placeholder_values.values_mut() { |
94 | // Don't search our placeholder if it's the entire matched node, otherwise we'd | 94 | if let Some(placeholder_node) = &placeholder_value.node { |
95 | // find the same match over and over until we got a stack overflow. | 95 | // Don't search our placeholder if it's the entire matched node, otherwise we'd |
96 | if placeholder_value.node != *code { | 96 | // find the same match over and over until we got a stack overflow. |
97 | self.find_matches( | 97 | if placeholder_node != code { |
98 | &placeholder_value.node, | 98 | self.find_matches( |
99 | restrict_range, | 99 | placeholder_node, |
100 | &mut placeholder_value.inner_matches, | 100 | restrict_range, |
101 | ); | 101 | &mut placeholder_value.inner_matches, |
102 | ); | ||
103 | } | ||
102 | } | 104 | } |
103 | } | 105 | } |
104 | matches_out.matches.push(m); | 106 | matches_out.matches.push(m); |