mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Handle generic args per arg index
Add more test cases for generic args
This commit is contained in:
parent
0f2eba54db
commit
75fb3de310
4 changed files with 220 additions and 45 deletions
|
@ -1709,7 +1709,11 @@ impl Trait {
|
|||
db.trait_data(self.id).is_unsafe
|
||||
}
|
||||
|
||||
pub fn type_parameters(&self, db: &dyn HirDatabase) -> Vec<TypeOrConstParamData> {
|
||||
pub fn type_or_const_param_count(
|
||||
&self,
|
||||
db: &dyn HirDatabase,
|
||||
count_required_only: bool,
|
||||
) -> usize {
|
||||
db.generic_params(GenericDefId::from(self.id))
|
||||
.type_or_consts
|
||||
.iter()
|
||||
|
@ -1721,9 +1725,9 @@ impl Trait {
|
|||
}
|
||||
_ => true,
|
||||
})
|
||||
.map(|(_, ty)|ty.clone())
|
||||
.collect()
|
||||
}
|
||||
.filter(|(_, ty)| !count_required_only || !ty.has_default())
|
||||
.count()
|
||||
}
|
||||
}
|
||||
|
||||
impl HasVisibility for Trait {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue