Skip to content

Commit ade0176

Browse files
committed
Remove dead code
1 parent 09bc7ca commit ade0176

File tree

2 files changed

+9
-25
lines changed

2 files changed

+9
-25
lines changed

crates/ra_hir/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub use crate::{
4747
},
4848
has_source::HasSource,
4949
semantics::{original_range, Semantics, SemanticsScope},
50-
source_analyzer::{PathResolution, ScopeEntryWithSyntax},
50+
source_analyzer::PathResolution,
5151
};
5252

5353
pub use hir_def::{

crates/ra_hir/src/source_analyzer.rs

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ use ra_syntax::{
2525
};
2626

2727
use crate::{
28-
db::HirDatabase, Adt, Const, EnumVariant, Function, Local, MacroDef, Name, Path, Static,
29-
Struct, Trait, Type, TypeAlias, TypeParam,
28+
db::HirDatabase, Adt, Const, EnumVariant, Function, Local, MacroDef, Path, Static, Struct,
29+
Trait, Type, TypeAlias, TypeParam,
3030
};
3131

3232
/// `SourceAnalyzer` is a convenience wrapper which exposes HIR API in terms of
@@ -53,22 +53,6 @@ pub enum PathResolution {
5353
AssocItem(crate::AssocItem),
5454
}
5555

56-
#[derive(Debug, Clone, PartialEq, Eq)]
57-
pub struct ScopeEntryWithSyntax {
58-
pub(crate) name: Name,
59-
pub(crate) ptr: Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>,
60-
}
61-
62-
impl ScopeEntryWithSyntax {
63-
pub fn name(&self) -> &Name {
64-
&self.name
65-
}
66-
67-
pub fn ptr(&self) -> Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>> {
68-
self.ptr
69-
}
70-
}
71-
7256
#[derive(Debug)]
7357
pub struct ReferenceDescriptor {
7458
pub range: TextRange,
@@ -235,16 +219,16 @@ impl SourceAnalyzer {
235219
resolve_hir_path(db, &self.resolver, &hir_path)
236220
}
237221

238-
fn resolve_local_name(&self, name_ref: &ast::NameRef) -> Option<ScopeEntryWithSyntax> {
222+
fn resolve_local_name(
223+
&self,
224+
name_ref: &ast::NameRef,
225+
) -> Option<Either<AstPtr<ast::Pat>, AstPtr<ast::SelfParam>>> {
239226
let name = name_ref.as_name();
240227
let source_map = self.body_source_map.as_ref()?;
241228
let scopes = self.scopes.as_ref()?;
242229
let scope = scope_for(scopes, source_map, InFile::new(self.file_id, name_ref.syntax()))?;
243230
let entry = scopes.resolve_name_in_scope(scope, &name)?;
244-
Some(ScopeEntryWithSyntax {
245-
name: entry.name().clone(),
246-
ptr: source_map.pat_syntax(entry.pat())?.value,
247-
})
231+
Some(source_map.pat_syntax(entry.pat())?.value)
248232
}
249233

250234
// FIXME: we only use this in `inline_local_variable` assist, ideally, we
@@ -258,7 +242,7 @@ impl SourceAnalyzer {
258242
.filter_map(ast::NameRef::cast)
259243
.filter(|name_ref| match self.resolve_local_name(&name_ref) {
260244
None => false,
261-
Some(entry) => entry.ptr() == ptr,
245+
Some(d_ptr) => d_ptr == ptr,
262246
})
263247
.map(|name_ref| ReferenceDescriptor {
264248
name: name_ref.text().to_string(),

0 commit comments

Comments
 (0)