mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Remove RetType
This commit is contained in:
parent
2f0969b873
commit
052404565e
1 changed files with 3 additions and 18 deletions
|
@ -744,19 +744,15 @@ impl Function {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get this function's return type
|
/// Get this function's return type
|
||||||
///
|
pub fn ret_type(self, db: &dyn HirDatabase) -> Type {
|
||||||
/// The returned type can be converted to a [`Type`] via its `ty`
|
|
||||||
/// method.
|
|
||||||
pub fn ret_type(self, db: &dyn HirDatabase) -> RetType {
|
|
||||||
let resolver = self.id.resolver(db.upcast());
|
let resolver = self.id.resolver(db.upcast());
|
||||||
let ret_type = &db.function_data(self.id).ret_type;
|
let ret_type = &db.function_data(self.id).ret_type;
|
||||||
let ctx = hir_ty::TyLoweringContext::new(db, &resolver);
|
let ctx = hir_ty::TyLoweringContext::new(db, &resolver);
|
||||||
let environment = TraitEnvironment::lower(db, &resolver);
|
let environment = TraitEnvironment::lower(db, &resolver);
|
||||||
let ty = Type {
|
Type {
|
||||||
krate: self.id.lookup(db.upcast()).container.module(db.upcast()).krate,
|
krate: self.id.lookup(db.upcast()).container.module(db.upcast()).krate,
|
||||||
ty: InEnvironment { value: Ty::from_hir_ext(&ctx, ret_type).0, environment },
|
ty: InEnvironment { value: Ty::from_hir_ext(&ctx, ret_type).0, environment },
|
||||||
};
|
}
|
||||||
RetType { ty }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn self_param(self, db: &dyn HirDatabase) -> Option<SelfParam> {
|
pub fn self_param(self, db: &dyn HirDatabase) -> Option<SelfParam> {
|
||||||
|
@ -842,17 +838,6 @@ impl From<Mutability> for Access {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub struct RetType {
|
|
||||||
ty: Type,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl RetType {
|
|
||||||
pub fn ty(&self) -> &Type {
|
|
||||||
&self.ty
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Param {
|
pub struct Param {
|
||||||
ty: Type,
|
ty: Type,
|
||||||
|
|
Loading…
Reference in a new issue