From 04735abfaec30461252aecde10bb1d0d344728f1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 27 Nov 2019 22:21:01 +0300 Subject: Minimize API --- crates/ra_hir/src/code_model.rs | 9 +-------- crates/ra_hir_ty/src/lower.rs | 11 +++-------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 5a3e24e9e..9488521a9 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -29,10 +29,7 @@ use ra_syntax::{ast, AstNode, SyntaxNode}; use crate::{ db::{DefDatabase, HirDatabase}, ty::display::HirFormatter, - ty::{ - self, InEnvironment, InferenceResult, TraitEnvironment, TraitRef, Ty, TyDefId, TypeCtor, - TypeWalk, - }, + ty::{self, InEnvironment, InferenceResult, TraitEnvironment, Ty, TyDefId, TypeCtor, TypeWalk}, CallableDef, Either, HirDisplay, Name, Source, }; @@ -731,10 +728,6 @@ impl Trait { db.trait_data(self.id).items.iter().map(|(_name, it)| (*it).into()).collect() } - pub fn trait_ref(self, db: &impl HirDatabase) -> TraitRef { - TraitRef::for_trait(db, self.id) - } - pub fn is_auto(self, db: &impl DefDatabase) -> bool { db.trait_data(self.id).auto } diff --git a/crates/ra_hir_ty/src/lower.rs b/crates/ra_hir_ty/src/lower.rs index f8331d257..091c60f4f 100644 --- a/crates/ra_hir_ty/src/lower.rs +++ b/crates/ra_hir_ty/src/lower.rs @@ -363,7 +363,7 @@ pub(super) fn substs_from_path_segment( } impl TraitRef { - pub(crate) fn from_path( + fn from_path( db: &impl HirDatabase, resolver: &Resolver, path: &Path, @@ -377,7 +377,7 @@ impl TraitRef { Some(TraitRef::from_resolved_path(db, resolver, resolved.into(), segment, explicit_self_ty)) } - pub(super) fn from_resolved_path( + pub(crate) fn from_resolved_path( db: &impl HirDatabase, resolver: &Resolver, resolved: TraitId, @@ -391,7 +391,7 @@ impl TraitRef { TraitRef { trait_: resolved, substs } } - pub(crate) fn from_hir( + fn from_hir( db: &impl HirDatabase, resolver: &Resolver, type_ref: &TypeRef, @@ -415,11 +415,6 @@ impl TraitRef { substs_from_path_segment(db, resolver, segment, Some(resolved.into()), !has_self_param) } - pub fn for_trait(db: &impl HirDatabase, trait_: TraitId) -> TraitRef { - let substs = Substs::identity(&db.generic_params(trait_.into())); - TraitRef { trait_, substs } - } - pub(crate) fn from_type_bound( db: &impl HirDatabase, resolver: &Resolver, -- cgit v1.2.3