mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Minimize API
This commit is contained in:
parent
8d34696826
commit
04735abfae
2 changed files with 4 additions and 16 deletions
|
@ -29,10 +29,7 @@ use ra_syntax::{ast, AstNode, SyntaxNode};
|
||||||
use crate::{
|
use crate::{
|
||||||
db::{DefDatabase, HirDatabase},
|
db::{DefDatabase, HirDatabase},
|
||||||
ty::display::HirFormatter,
|
ty::display::HirFormatter,
|
||||||
ty::{
|
ty::{self, InEnvironment, InferenceResult, TraitEnvironment, Ty, TyDefId, TypeCtor, TypeWalk},
|
||||||
self, InEnvironment, InferenceResult, TraitEnvironment, TraitRef, Ty, TyDefId, TypeCtor,
|
|
||||||
TypeWalk,
|
|
||||||
},
|
|
||||||
CallableDef, Either, HirDisplay, Name, Source,
|
CallableDef, Either, HirDisplay, Name, Source,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -731,10 +728,6 @@ impl Trait {
|
||||||
db.trait_data(self.id).items.iter().map(|(_name, it)| (*it).into()).collect()
|
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 {
|
pub fn is_auto(self, db: &impl DefDatabase) -> bool {
|
||||||
db.trait_data(self.id).auto
|
db.trait_data(self.id).auto
|
||||||
}
|
}
|
||||||
|
|
|
@ -363,7 +363,7 @@ pub(super) fn substs_from_path_segment(
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TraitRef {
|
impl TraitRef {
|
||||||
pub(crate) fn from_path(
|
fn from_path(
|
||||||
db: &impl HirDatabase,
|
db: &impl HirDatabase,
|
||||||
resolver: &Resolver,
|
resolver: &Resolver,
|
||||||
path: &Path,
|
path: &Path,
|
||||||
|
@ -377,7 +377,7 @@ impl TraitRef {
|
||||||
Some(TraitRef::from_resolved_path(db, resolver, resolved.into(), segment, explicit_self_ty))
|
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,
|
db: &impl HirDatabase,
|
||||||
resolver: &Resolver,
|
resolver: &Resolver,
|
||||||
resolved: TraitId,
|
resolved: TraitId,
|
||||||
|
@ -391,7 +391,7 @@ impl TraitRef {
|
||||||
TraitRef { trait_: resolved, substs }
|
TraitRef { trait_: resolved, substs }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn from_hir(
|
fn from_hir(
|
||||||
db: &impl HirDatabase,
|
db: &impl HirDatabase,
|
||||||
resolver: &Resolver,
|
resolver: &Resolver,
|
||||||
type_ref: &TypeRef,
|
type_ref: &TypeRef,
|
||||||
|
@ -415,11 +415,6 @@ impl TraitRef {
|
||||||
substs_from_path_segment(db, resolver, segment, Some(resolved.into()), !has_self_param)
|
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(
|
pub(crate) fn from_type_bound(
|
||||||
db: &impl HirDatabase,
|
db: &impl HirDatabase,
|
||||||
resolver: &Resolver,
|
resolver: &Resolver,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue