Auto merge of #16274 - dfireBird:completion_score, r=Veykril

Add notable_trait predicate to `CompletionRelevance`

Given a score of 1 for now, will change as per reviews needed.
This commit is contained in:
bors 2024-01-10 11:16:52 +00:00
commit b201684982
5 changed files with 108 additions and 5 deletions

View file

@ -207,6 +207,13 @@ impl Attrs {
})
}
pub fn has_doc_notable_trait(&self) -> bool {
self.by_key("doc").tt_values().any(|tt| {
tt.delimiter.kind == DelimiterKind::Parenthesis &&
matches!(&*tt.token_trees, [tt::TokenTree::Leaf(tt::Leaf::Ident(ident))] if ident.text == "notable_trait")
})
}
pub fn doc_exprs(&self) -> impl Iterator<Item = DocExpr> + '_ {
self.by_key("doc").tt_values().map(DocExpr::parse)
}