Skip to content

Commit 04fc937

Browse files
committed
Add back Param struct
1 parent c6ddb90 commit 04fc937

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

crates/hir/src/code_model.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ impl Function {
708708
Some(SelfParam { func: self.id })
709709
}
710710

711-
pub fn params(self, db: &dyn HirDatabase) -> Vec<Type> {
711+
pub fn params(self, db: &dyn HirDatabase) -> Vec<Param> {
712712
let resolver = self.id.resolver(db.upcast());
713713
let ctx = hir_ty::TyLoweringContext::new(db, &resolver);
714714
let environment = TraitEnvironment::lower(db, &resolver);
@@ -724,7 +724,7 @@ impl Function {
724724
environment: environment.clone(),
725725
},
726726
};
727-
ty
727+
Param { ty }
728728
})
729729
.collect()
730730
}
@@ -754,6 +754,16 @@ impl From<Mutability> for Access {
754754
}
755755
}
756756

757+
pub struct Param {
758+
ty: Type,
759+
}
760+
761+
impl Param {
762+
pub fn ty(&self) -> &Type {
763+
&self.ty
764+
}
765+
}
766+
757767
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
758768
pub struct SelfParam {
759769
func: FunctionId,

crates/ide/src/completion/presentation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl Completions {
231231
if let Some(pat) = it.pat() {
232232
let name = pat.to_string();
233233
let arg = name.trim_start_matches('_');
234-
return Some(add_arg(arg, &param_ty, ctx));
234+
return Some(add_arg(arg, param_ty.ty(), ctx));
235235
}
236236
None
237237
})

0 commit comments

Comments
 (0)