diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 3d956afa7..7ac1bf461 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -507,30 +507,6 @@ impl Function { | |||
507 | db.function_data(self.id).params.clone() | 507 | db.function_data(self.id).params.clone() |
508 | } | 508 | } |
509 | 509 | ||
510 | /// The containing impl block, if this is a method. | ||
511 | pub fn impl_block(self, db: &impl DefDatabase) -> Option<ImplBlock> { | ||
512 | match self.container(db) { | ||
513 | Some(Container::ImplBlock(it)) => Some(it), | ||
514 | _ => None, | ||
515 | } | ||
516 | } | ||
517 | |||
518 | /// The containing trait, if this is a trait method definition. | ||
519 | pub fn parent_trait(self, db: &impl DefDatabase) -> Option<Trait> { | ||
520 | match self.container(db) { | ||
521 | Some(Container::Trait(it)) => Some(it), | ||
522 | _ => None, | ||
523 | } | ||
524 | } | ||
525 | |||
526 | pub fn container(self, db: &impl DefDatabase) -> Option<Container> { | ||
527 | match self.id.lookup(db).container { | ||
528 | ContainerId::TraitId(it) => Some(Container::Trait(it.into())), | ||
529 | ContainerId::ImplId(it) => Some(Container::ImplBlock(it.into())), | ||
530 | ContainerId::ModuleId(_) => None, | ||
531 | } | ||
532 | } | ||
533 | |||
534 | pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { | 510 | pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) { |
535 | let infer = db.infer(self.id.into()); | 511 | let infer = db.infer(self.id.into()); |
536 | infer.add_diagnostics(db, self.id, sink); | 512 | infer.add_diagnostics(db, self.id, sink); |
@@ -709,15 +685,6 @@ impl AssocItem { | |||
709 | AssocItem::TypeAlias(t) => t.module(db), | 685 | AssocItem::TypeAlias(t) => t.module(db), |
710 | } | 686 | } |
711 | } | 687 | } |
712 | |||
713 | pub fn container(self, db: &impl DefDatabase) -> Container { | ||
714 | match self { | ||
715 | AssocItem::Function(f) => f.container(db), | ||
716 | AssocItem::Const(c) => c.container(db), | ||
717 | AssocItem::TypeAlias(t) => t.container(db), | ||
718 | } | ||
719 | .expect("AssocItem without container") | ||
720 | } | ||
721 | } | 688 | } |
722 | 689 | ||
723 | #[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] | 690 | #[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] |