We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6bbeffc commit 3eea41aCopy full SHA for 3eea41a
crates/ra_ssr/src/resolving.rs
@@ -176,13 +176,7 @@ impl<'db> ResolutionScope<'db> {
176
177
/// Returns the function in which SSR was invoked, if any.
178
pub(crate) fn current_function(&self) -> Option<SyntaxNode> {
179
- let mut node = self.node.clone();
180
- loop {
181
- if node.kind() == SyntaxKind::FN {
182
- return Some(node);
183
- }
184
- node = node.parent()?;
185
+ self.node.ancestors().find(|node| node.kind() == SyntaxKind::FN).map(|node| node.clone())
186
}
187
188
fn resolve_path(&self, path: &ast::Path) -> Option<hir::PathResolution> {
0 commit comments