aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-27 19:30:38 +0000
committerGitHub <[email protected]>2019-11-27 19:30:38 +0000
commitc0bb667a7dfaecfefacf0b3b6cb1e483aac6747a (patch)
tree3780635e0f8987c07db22210408b1816388e5869
parent385899d2f084ce688324a3db24e71b8b9f55d6e6 (diff)
parent04735abfaec30461252aecde10bb1d0d344728f1 (diff)
Merge #2432
2432: Minimize API r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--crates/ra_hir/src/code_model.rs9
-rw-r--r--crates/ra_hir_ty/src/lower.rs11
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};
29use crate::{ 29use crate::{
30 db::{DefDatabase, HirDatabase}, 30 db::{DefDatabase, HirDatabase},
31 ty::display::HirFormatter, 31 ty::display::HirFormatter,
32 ty::{ 32 ty::{self, InEnvironment, InferenceResult, TraitEnvironment, Ty, TyDefId, TypeCtor, TypeWalk},
33 self, InEnvironment, InferenceResult, TraitEnvironment, TraitRef, Ty, TyDefId, TypeCtor,
34 TypeWalk,
35 },
36 CallableDef, Either, HirDisplay, Name, Source, 33 CallableDef, Either, HirDisplay, Name, Source,
37}; 34};
38 35
@@ -731,10 +728,6 @@ impl Trait {
731 db.trait_data(self.id).items.iter().map(|(_name, it)| (*it).into()).collect() 728 db.trait_data(self.id).items.iter().map(|(_name, it)| (*it).into()).collect()
732 } 729 }
733 730
734 pub fn trait_ref(self, db: &impl HirDatabase) -> TraitRef {
735 TraitRef::for_trait(db, self.id)
736 }
737
738 pub fn is_auto(self, db: &impl DefDatabase) -> bool { 731 pub fn is_auto(self, db: &impl DefDatabase) -> bool {
739 db.trait_data(self.id).auto 732 db.trait_data(self.id).auto
740 } 733 }
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(
363} 363}
364 364
365impl TraitRef { 365impl TraitRef {
366 pub(crate) fn from_path( 366 fn from_path(
367 db: &impl HirDatabase, 367 db: &impl HirDatabase,
368 resolver: &Resolver, 368 resolver: &Resolver,
369 path: &Path, 369 path: &Path,
@@ -377,7 +377,7 @@ impl TraitRef {
377 Some(TraitRef::from_resolved_path(db, resolver, resolved.into(), segment, explicit_self_ty)) 377 Some(TraitRef::from_resolved_path(db, resolver, resolved.into(), segment, explicit_self_ty))
378 } 378 }
379 379
380 pub(super) fn from_resolved_path( 380 pub(crate) fn from_resolved_path(
381 db: &impl HirDatabase, 381 db: &impl HirDatabase,
382 resolver: &Resolver, 382 resolver: &Resolver,
383 resolved: TraitId, 383 resolved: TraitId,
@@ -391,7 +391,7 @@ impl TraitRef {
391 TraitRef { trait_: resolved, substs } 391 TraitRef { trait_: resolved, substs }
392 } 392 }
393 393
394 pub(crate) fn from_hir( 394 fn from_hir(
395 db: &impl HirDatabase, 395 db: &impl HirDatabase,
396 resolver: &Resolver, 396 resolver: &Resolver,
397 type_ref: &TypeRef, 397 type_ref: &TypeRef,
@@ -415,11 +415,6 @@ impl TraitRef {
415 substs_from_path_segment(db, resolver, segment, Some(resolved.into()), !has_self_param) 415 substs_from_path_segment(db, resolver, segment, Some(resolved.into()), !has_self_param)
416 } 416 }
417 417
418 pub fn for_trait(db: &impl HirDatabase, trait_: TraitId) -> TraitRef {
419 let substs = Substs::identity(&db.generic_params(trait_.into()));
420 TraitRef { trait_, substs }
421 }
422
423 pub(crate) fn from_type_bound( 418 pub(crate) fn from_type_bound(
424 db: &impl HirDatabase, 419 db: &impl HirDatabase,
425 resolver: &Resolver, 420 resolver: &Resolver,