mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Extract generic_params method to a HasGenericParams trait
This commit is contained in:
parent
4497e1d3ea
commit
8bcbcc454c
7 changed files with 33 additions and 37 deletions
|
@ -118,3 +118,16 @@ impl From<Container> for GenericDef {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait HasGenericParams {
|
||||
fn generic_params(self, db: &impl DefDatabase) -> Arc<GenericParams>;
|
||||
}
|
||||
|
||||
impl<T> HasGenericParams for T
|
||||
where
|
||||
T: Into<GenericDef>,
|
||||
{
|
||||
fn generic_params(self, db: &impl DefDatabase) -> Arc<GenericParams> {
|
||||
db.generic_params(self.into())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue