11210: feat: Deprioritize ops methods in completion r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10593



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
bors[bot]
2022-01-11 09:39:12 +00:00
committed by GitHub
8 changed files with 130 additions and 38 deletions

View File

@@ -1610,6 +1610,12 @@ pub struct Trait {
}
impl Trait {
pub fn lang(db: &dyn HirDatabase, krate: Crate, name: &Name) -> Option<Trait> {
db.lang_item(krate.into(), name.to_smol_str())
.and_then(LangItemTarget::as_trait)
.map(Into::into)
}
pub fn module(self, db: &dyn HirDatabase) -> Module {
Module { id: self.id.lookup(db.upcast()).container }
}