Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/resolver.rs')
| -rw-r--r-- | crates/hir-def/src/resolver.rs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/crates/hir-def/src/resolver.rs b/crates/hir-def/src/resolver.rs index d2048c8757..9b9335f191 100644 --- a/crates/hir-def/src/resolver.rs +++ b/crates/hir-def/src/resolver.rs @@ -219,7 +219,7 @@ impl Resolver { Scope::ExprScope(_) | Scope::MacroDefScope(_) => continue, Scope::GenericParams { params, def } => { if let &GenericDefId::ImplId(impl_) = def { - if *first_name == sym::Self_.clone() { + if *first_name == sym::Self_ { return Some(( TypeNs::SelfType(impl_), remaining_idx(), @@ -228,7 +228,7 @@ impl Resolver { )); } } else if let &GenericDefId::AdtId(adt) = def { - if *first_name == sym::Self_.clone() { + if *first_name == sym::Self_ { return Some(( TypeNs::AdtSelfType(adt), remaining_idx(), @@ -365,7 +365,7 @@ impl Resolver { } }; let n_segments = path.segments().len(); - let tmp = Name::new_symbol_root(sym::self_.clone()); + let tmp = Name::new_symbol_root(sym::self_); let first_name = if path.is_self() { &tmp } else { path.segments().first()? }; let skip_to_mod = path.kind != PathKind::Plain && !path.is_self(); if skip_to_mod { @@ -397,7 +397,7 @@ impl Resolver { } Scope::GenericParams { params, def } => { if let &GenericDefId::ImplId(impl_) = def { - if *first_name == sym::Self_.clone() { + if *first_name == sym::Self_ { return Some(( ResolveValueResult::ValueNs(ValueNs::ImplSelf(impl_), None), ResolvePathResultPrefixInfo::default(), @@ -425,14 +425,14 @@ impl Resolver { Scope::ExprScope(_) | Scope::MacroDefScope(_) => continue, Scope::GenericParams { params, def } => { if let &GenericDefId::ImplId(impl_) = def { - if *first_name == sym::Self_.clone() { + if *first_name == sym::Self_ { return Some(( ResolveValueResult::Partial(TypeNs::SelfType(impl_), 1, None), ResolvePathResultPrefixInfo::default(), )); } } else if let &GenericDefId::AdtId(adt) = def { - if *first_name == sym::Self_.clone() { + if *first_name == sym::Self_ { let ty = TypeNs::AdtSelfType(adt); return Some(( ResolveValueResult::Partial(ty, 1, None), @@ -1004,12 +1004,9 @@ impl Scope { } &Scope::GenericParams { ref params, def: parent } => { if let GenericDefId::ImplId(impl_) = parent { - acc.add( - &Name::new_symbol_root(sym::Self_.clone()), - ScopeDef::ImplSelfType(impl_), - ); + acc.add(&Name::new_symbol_root(sym::Self_), ScopeDef::ImplSelfType(impl_)); } else if let GenericDefId::AdtId(adt) = parent { - acc.add(&Name::new_symbol_root(sym::Self_.clone()), ScopeDef::AdtSelfType(adt)); + acc.add(&Name::new_symbol_root(sym::Self_), ScopeDef::AdtSelfType(adt)); } for (local_id, param) in params.iter_type_or_consts() { |