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.
2 parents 989c06b + 087122a commit df3d3d8Copy full SHA for df3d3d8
crates/ide/src/syntax_highlighting/highlight.rs
@@ -712,11 +712,13 @@ fn parent_matches<N: AstNode>(token: &SyntaxToken) -> bool {
712
token.parent().map_or(false, |it| N::can_cast(it.kind()))
713
}
714
715
-fn is_in_fn_with_self_param<N: AstNode>(node: &N) -> bool {
+fn is_in_fn_with_self_param(node: &ast::NameRef) -> bool {
716
node.syntax()
717
.ancestors()
718
- .take_while(|node| ast::Expr::can_cast(node.kind()) || ast::Fn::can_cast(node.kind()))
719
- .find_map(ast::Fn::cast)
720
- .and_then(|s| s.param_list()?.self_param())
+ .find_map(ast::Item::cast)
+ .and_then(|item| match item {
+ ast::Item::Fn(fn_) => fn_.param_list()?.self_param(),
721
+ _ => None,
722
+ })
723
.is_some()
724
0 commit comments