Adds impl Deref assist

This commit is contained in:
jake 2021-04-11 00:31:20 -07:00
parent 5b40342d2d
commit a624e2ea8d
6 changed files with 185 additions and 0 deletions

View file

@ -113,6 +113,10 @@ impl FamousDefs<'_, '_> {
self.find_module("core:iter")
}
pub fn core_ops_Deref(&self) -> Option<Trait> {
self.find_trait("core:ops:Deref")
}
fn find_trait(&self, path: &str) -> Option<Trait> {
match self.find_def(path)? {
hir::ScopeDef::ModuleDef(hir::ModuleDef::Trait(it)) => Some(it),