mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Simplify
This commit is contained in:
parent
6d6e0b8f21
commit
b36f12dba5
4 changed files with 112 additions and 184 deletions
|
@ -682,20 +682,7 @@ impl<'db> SemanticsImpl<'db> {
|
|||
fn resolve_lifetime_param(&self, lifetime: &ast::Lifetime) -> Option<LifetimeParam> {
|
||||
let text = lifetime.text();
|
||||
let lifetime_param = lifetime.syntax().ancestors().find_map(|syn| {
|
||||
let gpl = match_ast! {
|
||||
match syn {
|
||||
ast::Fn(it) => it.generic_param_list()?,
|
||||
ast::TypeAlias(it) => it.generic_param_list()?,
|
||||
ast::Struct(it) => it.generic_param_list()?,
|
||||
ast::Enum(it) => it.generic_param_list()?,
|
||||
ast::Union(it) => it.generic_param_list()?,
|
||||
ast::Trait(it) => it.generic_param_list()?,
|
||||
ast::Impl(it) => it.generic_param_list()?,
|
||||
ast::WherePred(it) => it.generic_param_list()?,
|
||||
ast::ForType(it) => it.generic_param_list()?,
|
||||
_ => return None,
|
||||
}
|
||||
};
|
||||
let gpl = ast::DynGenericParamsOwner::cast(syn)?.generic_param_list()?;
|
||||
gpl.lifetime_params()
|
||||
.find(|tp| tp.lifetime().as_ref().map(|lt| lt.text()).as_ref() == Some(&text))
|
||||
})?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue