aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ssr/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ssr/src')
-rw-r--r--crates/ra_ssr/src/resolving.rs8
1 files changed, 1 insertions, 7 deletions
diff --git a/crates/ra_ssr/src/resolving.rs b/crates/ra_ssr/src/resolving.rs
index 0ac929bd5..df60048eb 100644
--- a/crates/ra_ssr/src/resolving.rs
+++ b/crates/ra_ssr/src/resolving.rs
@@ -176,13 +176,7 @@ impl<'db> ResolutionScope<'db> {
176 176
177 /// Returns the function in which SSR was invoked, if any. 177 /// Returns the function in which SSR was invoked, if any.
178 pub(crate) fn current_function(&self) -> Option<SyntaxNode> { 178 pub(crate) fn current_function(&self) -> Option<SyntaxNode> {
179 let mut node = self.node.clone(); 179 self.node.ancestors().find(|node| node.kind() == SyntaxKind::FN).map(|node| node.clone())
180 loop {
181 if node.kind() == SyntaxKind::FN {
182 return Some(node);
183 }
184 node = node.parent()?;
185 }
186 } 180 }
187 181
188 fn resolve_path(&self, path: &ast::Path) -> Option<hir::PathResolution> { 182 fn resolve_path(&self, path: &ast::Path) -> Option<hir::PathResolution> {