Lookup lang attribute on assoc item trait directly

This commit is contained in:
Lukas Wirth 2022-01-11 10:07:16 +01:00
parent 94b369faa3
commit 4901ea3eef
4 changed files with 67 additions and 54 deletions

View file

@ -400,6 +400,7 @@ mod tests {
(relevance.exact_name_match, "name"),
(relevance.is_local, "local"),
(relevance.exact_postfix_snippet_match, "snippet"),
(relevance.is_op_method, "op_method"),
]
.into_iter()
.filter_map(|(cond, desc)| if cond { Some(desc) } else { None })
@ -1352,6 +1353,23 @@ fn main() {
)
}
#[test]
fn op_method_relevances() {
check_relevance(
r#"
#[lang = "sub"]
trait Sub {
fn sub(self, other: Self) -> Self { self }
}
impl Sub for u32 {}
fn foo(a: u32) { a.$0 }
"#,
expect![[r#"
me sub() (as Sub) [op_method]
"#]],
)
}
#[test]
fn struct_field_method_ref() {
check_kinds(